java - How do I do "sub-categories" in Preferences -
i have preference page 3 options "indented" or sort of subcategories under "custom flashcards" preference. right under each other , seem different settings. how make seem subcategories of "custom flashcards" preference. 3 options become enabled when custom flashcards checked. thank you!
<?xml version="1.0" encoding="utf-8"?> <preferencescreen xmlns:android="http://schemas.android.com/apk/res/android"> < preferencecategory android:title="flashcard selection" android:key="flashcard_selection"> <checkboxpreference android:key="all_flashcards" android:summary="display flashcards" android:title="all flashcards" android:defaultvalue="true" /> <checkboxpreference android:key="custom_flashcards" android:summary="display customized list of flashcards" android:title="custom flashcards" android:defaultvalue="false"/> <checkboxpreference android:key="red_flashcards" android:dependency="custom_flashcards" android:summary="display red flashcards" android:title="red" android:defaultvalue="false" /> <checkboxpreference android:key="yellow_flashcards" android:summary="display yellow flashcards" android:title="yellow" android:defaultvalue="false" android:dependency="custom_flashcards" /> <checkboxpreference android:key="green_flashcards" android:summary="display green flashcards" android:title="green" android:defaultvalue="false" android:dependency="custom_flashcards" /> <listpreference android:key="frontside_preference" android:summary="choose want on front side" android:title="front side" android:entries= "@array/frontside_selection_array" android:entryvalues ="@array/frontside_selection_values" android:defaultvalue="1" /> </preferencecategory> </preferencescreen>
one option create subcategory use nested preference screen switching custom flashcards checkboxpreference tag preferencescreen tag , closing after 3 custom options. when custom flashcard option clicked, new screen appear 3 checkbox options.
<preferencecategory android:key="flashcard_selection" android:title="flashcard selection"> <checkboxpreference android:defaultvalue="true" android:key="all_flashcards" android:summary="display flashcards" android:title="all flashcards" /> <preferencescreen android:defaultvalue="false" android:key="custom_flashcards" android:summary="display customized list of flashcards" android:title="custom flashcards" > <checkboxpreference android:defaultvalue="false" android:dependency="custom_flashcards" android:key="red_flashcards" android:summary="display red flashcards" android:title="red" /> <checkboxpreference android:defaultvalue="false" android:dependency="custom_flashcards" android:key="yellow_flashcards" android:summary="display yellow flashcards" android:title="yellow" /> <checkboxpreference android:defaultvalue="false" android:dependency="custom_flashcards" android:key="green_flashcards" android:summary="display green flashcards" android:title="green" /> </preferencescreen> </preferencecategory>
Comments
Post a Comment