Change the prefix Element Description Text color in Android 4

I have an example of preference items below

<CheckBoxPreference android:key="chkSound" android:summary="Sound is Off" android:title="Sound" /> 

I use the theme in res / values ​​to change the color of the summary text

  <style name="ThemeDarkText"> <item name="android:textColor">#000000</item> </style> 

And in the code I write this line

  setTheme(R.style.ThemeDarkText); 

It works fine in Android 2.1, but when I tried to run it on another os (ex Android 4.0) it did not change the final color of the text, only the color of the name. !!

Any help?

+7
source share
2 answers

I had the same problem.

Interestingly, the Edit Preference overview was colored correctly β€” red, but the check box and preference screen were white.

This is my decision:

Add this to style.xml in your theme:

 <item name="android:textColorSecondary">@color/your_color</item> 
+24
source

For those using Theme.AppCompat (Lollipop), this is controlled

<item name="colorAccent">@color/accent</item>

+1
source

All Articles