2014-02-22 93 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

是的,這是我最終做的感謝,指出我在正確的方向。 –