2

I've made the change to the PreferenceScreen background color to blue, but I can't figure out how to change the font color for ListPreference. I mean the font color on the list. This font color is black in the blue background.

Is there a way to change this font color?

Thank you very much

Edited: added style.xml

<style name="Widget.TextView.ListSeparator" parent="@android:style/Widget.TextView">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textStyle">bold</item>
<item name="android:textSize">14sp</item>
<item name="android:gravity">center_vertical</item>
</style>

<style name="PreferenceListHeader" parent="Widget.TextView.ListSeparator">   
<item name="android:paddingTop">6dp</item>
<item name="android:paddingBottom">6dp</item>
<item name="android:paddingLeft">12dp</item>        
<item name="android:textStyle">bold</item>
<item name="android:textSize">24sp</item> 
<item name="android:textColor">#000000</item>
<item name="android:background">#cccccc</item>          
</style>

<style name="My_Theme" parent="android:Theme">
<item name="android:listSeparatorTextViewStyle">@style/PreferenceListHeader</item>
<item name="android:background">#001EFF</item>
<item name="android:textColorTertiary">#D95869</item>

<item name="android:textColorPrimary">#FF6347</item>         
<item name="android:textColorSecondary">#00FF45</item>     
<item name="android:textSize">24sp</item>                   
</style>
IYM-14
  • 260
  • 2
  • 11

1 Answers1

1

You should define theme for your activity in res/values/styles.xml. android:textColorPrimary, android:textColorSecondary and android:textColorTertiary are what you are looking for.

<style name="PreferencesTheme" parent="android:Theme">
    <item name="android:textColorPrimary">@color/primary</item>
    <item name="android:textColorSecondary">@color/secondary</item>
    <item name="android:textColorTertiary">@color/tertiary</item>
</style>

Then set this theme to activity:

<activity
        android:name="your.package.name.YourPrefActivity"
        android:label="@string/app_name"
        android:theme="@style/PreferencesTheme"/>
erakitin
  • 11,437
  • 5
  • 44
  • 49
  • 1
    I had those except @color/tertiary I'll add this to my theme and see if it works. I'll report back when I get home. Thank you very much Erakitin – IYM-14 May 13 '14 at 16:32
  • ugg, it is not working :-( I updated the question with style.xml. I can change the header colors and everything else except the font color on those ListPreference entry Values/list – IYM-14 May 13 '14 at 23:34
  • Try to remove `android:textColor` from theme of your pref activity. – erakitin May 14 '14 at 04:54
  • 1
    I am sorry that was supposed to be #FF6347 I copied them from my app and deleted some of the comments, and I accidently deleted "Primary." I commented out the Primary and Secondary text colors because they changed the color of my headers and other front colors. I can change the text color of the titles, headers, summaries, etc. For some odd reasons, no matter what I have done, it just won't change the Listpreference Entry Values (the list of choice when click on Listpreference) front color. I just don't understand. – IYM-14 May 14 '14 at 11:26