Dependent preferences display wrong color font when disabled

android, android-preferences, android-styles, android-theme

Solution

you should define a color state list and put it inside the /res/color folder

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
    <item android:state_enabled="false" android:color="#FF00ff00"/>
    <item android:color="#FFff0000"/>
</selector>

Problem

In my app I am using several preferences, including some of them related with dependencies using the following attribute: `android:dependency="pref_key"`. Basically, when the checkbox is not selected, all the other preferences below are disabled: The problem happens when I setup back the following 3 lines in my custom theme: ``` <style name="AppThemeOrange" parent="@style/AppTheme"> <item name="android:textColorPrimary">@color/OrangeMain</item> <item name="android:textColorSecondary">@color/OrangeDark</item> <item name="android:textColorTertiary">@color/OrangeLight</item> (...) ``` The colors defined on these 3 attributes also override the default font color of the disabled preferences: The preferences are still well disabled, but the fonts displayed make believe the contrary... I searched in the default Holo Light styles and theme, but I have no idea where this is defined and why the styles above override these ones. Did anyone already meet the problem?

Original source