lundi 23 novembre 2015

Android MultiSelectListPreference with "Select All" checkbox in the title

I am new to Android. I have a MultiSelectListPreference and I would be able to check/uncheck all the boxes, possibly through a "Select All" checkbox next to the category title, in short something like this:

enter image description here

This is my MultiSelectListPreference from my preference xml file:

<MultiSelectListPreference
    android:title="Items list"
    android:key="itemsList"
    android:entries="@array/list"
    android:entryValues="@array/listValues"
    android:defaultValue="@array/listValues">
</MultiSelectListPreference>

Here the arrays:

<string-array name = "list">
     <item>Item 1</item>
     <item>Item 2</item>
     <item>Item 3</item>
     <item>Item 4</item>
</string-array>

<string-array name = "listValues">
     <item>1</item>
     <item>2</item>
     <item>3</item>
     <item>4</item>
</string-array>

Is there any way to implement it?




Aucun commentaire:

Enregistrer un commentaire