The PreferenceScreen isn't good enough for me, since I've to add items to a Spinner. Those items need to come from a data list.
I've got a custom ArrayAdapter that returns the name of the item, and when I click it. It returns the data that is contained within the item.
I want to use that same ArrayAdapter in a ListPreference (that's the spinner in the PreferenceScreen) but the ListPreference doesn't allow me to use a Adapter.
So, I want to recreate the look of the PreferenceScreen (with the PreferenceCategory's) without the use of the actual PreferenceScreen (and PreferenceCategory's)
Is this possible with a library? I haven't found one.
Thanks,
Tim
I tried to collect my first method - I hope I didn't forget to include some parts (aapart color definitions or statelist drawables, which is a trivial task to make your own)
Customizing the standard Preferences
/res/xml/prefs.xml
/res/layout/prefs.xml
/src/ACT_Prefs
/src/FRG_Prefs
To show my Preferences:
ctx is defined as
since I use it a lot, I define it once and for all.
[EDIT]
By request, I could add a method to make a
Fake PreferenceScreen
.The answer above is to difficult to implement, so I've designed my own version.
The layout xml
Toolbar xml:
Dimens xml:
Colors xml:
Just use the your way to store the Preferences. I've created a custom preference class that contains private keys so I can't post the code here without breaking it.
The advantage of using a custom layout like this is that you can add your own toolbar with this line as the first element of the first RelativeLayout.
To use the custom toolbar use this piece of code in your onCreate()