The default value in the ListPreference of array.xml

I would like to set the default value for ListPreference as the first element of an array declared in array.xml. I would like to do it quickly and easily.

Code like this:

<ListPreference android:key="fontSize" android:title="@string/fontSize" android:entries="@array/fontSize" android:entryValues="@array/fontSize[0]"/> 

of course "@ array / fontSize [0]" dosen't work, clearly, but is there a way to do something similar in XML or in SIMPLY code?

+4
source share

Source: https://habr.com/ru/post/1393015/


All Articles