2014-02-22 29 views
5

我正在尝试更改文本的颜色和偏好类别的背景。我搜索了网上的答案,但似乎没有任何工作。是否有人成功更改了偏好类别属性的颜色?我可以使用自定义布局来更改首选项类别的外观和风格吗?我需要更多的方向。请帮助Android偏好类别样式

这是我到目前为止有:

<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> 

颜色

<?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> 

我的偏好布局的一部分

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

而我的清单

<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"> 

谢谢

回答

5

是的。您可以使用自定义布局。看看这个问题的答案。 Custom PreferenceCategory Headings

+0

是的,这是我最终做的感谢,指出我在正确的方向。 –