简体   繁体   中英

How do i change the look of my android preferences?

Im having a couple of issues with my android preferences. Firstly i want a line divider/horizontal rule below my PreferenceCategory (Accounts), which in the preferences tutorial seems to automatically be placed under category headings, but in my case has not. Another issue is i would like to change the color of my preference title's (Add Account and Remove Account). At the moment they seem to be getting colored via my <item name="android:textColorPrimary">@color/text_primary</item> located in my style.xml , which i cannot change as i want the Settings title to remain white. Below is an image of where i currently am:

首选项截图

If anybody could advise me on resolving these issue's it would be much appreciated. Thanks

Just like any other UI aspect of Android , you can customize it using a custom XML file. Just create a new layout (ex. custom_preference) and just set that in your Preference :

<Preference
android:title="@string/label_pref_version"
android:key="@string/pref_version"
android:layout="@layout/custom_preference" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM