Android Preference Category Styling

回眸只為那壹抹淺笑 提交于 2020-01-03 10:41:10

问题


I am trying to change the color of the text and the background of the preference categories. I searched the webs for answers, but nothing seems to be working. Has anyone successfully changed the color of the preference category attributes? Could I use a custom layout to change looks and feel of the preference category? I need some more direction. Please help

Here is what I have so far:

<style name="Theme" parent="@style/android:Theme.Holo.Light">
    <item name="android:actionBarStyle">@style/ActionBar</item>
</style>

<style name="ActionBar" parent="@android:style/Widget.Holo.Light.ActionBar.Solid">
    <item name="android:background">@color/ab_grey</item>
</style>

<style name="PrefCatStyle" parent="Theme">
    <item name="android:textColor">@color/text_green</item>
    <item name="android:background">@color/pref_back</item>
</style>

colors

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="ab_grey">#adadad</color> <!--  #adadad--> 
    <color name="text_green">#000000</color>
    <color name="pref_back">#FFFFFF</color>
</resources>

Part of my Preference Layout

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
    <PreferenceCategory 
        android:title="Settings"
        android:key="settings_category"
        style="@style/PrefCatStyle">

And my part Manifest

    <application
        android:allowBackup="true"
        android:icon="@drawable/icon"
        android:label="@string/app_name"
        android:theme="@style/Theme" > 
...
        <activity
            android:name=".SettingsPrefActivity"
            android:parentActivityName=".MainActivity"
            android:theme="@style/emTextTheme">

Thanks


回答1:


yes. you can use custom layout. take a look at the answer of this question. Custom PreferenceCategory Headings



来源:https://stackoverflow.com/questions/21956823/android-preference-category-styling

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!