I have a simple preference_headers.xml
file. I want to add some categories on my preference headers. I have tried to implement <PreferenceCategory />
in my preference_headers.xml
, but it doesn't work. I'm using API level 11. As shown in the figure below, Android Developers from official website can add the categories. How can I add it too?
And here is a few of my preference_headers.xml
code. It won't work:
<preference-headers xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="ACCOUNT" >
<header android:fragment="com.example.preferenceheader.SettingsFragmentAccount"
android:title="@string/pref_header_category_account"
android:summary="@string/pref_header_summ_account"
android:icon="@drawable/ic_action_settings" />
</PreferenceCategory>
<PreferenceCategory android:title="APPLICATION" >
<header android:fragment="com.example.preferenceheader.SettingsFragmentApplication"
android:title="@string/pref_header_category_application"
android:summary="@string/pref_header_summ_application"
android:icon="@drawable/ic_action_group" />
</PreferenceCategory>
</preference-headers>
Thanks for your help.
It's been close to a year since this was asked but I run into this example at http://www.101apps.co.za/articles/preference-settings.html that I think describes the requirement of the question in great detail and explanation.
I hope that it will help someone as it has helped me since it details the process of building a preference screen with categories and headers on the same page!
Cheers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With