I have listpreference in my app , i want to customize it , i can set theme to prefs activity as bellow :
<activity
android:name=".Prefs"
android:label="@string/app_name"
android:theme="@style/PreferencesTheme">
preference style:
<?xml version="1.0" encoding="utf-8" ?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="PreferencesTheme" parent="android:Theme">
<item name="android:background">#FFDAB9</item>
<item name="android:textColor">@color/red_color</item>
<item name="android:textSize">20sp</item>
</style>
</resources>
The above style changes the ListPreference background and ListPreference title text size and text color BUT it doesn't change ListPreference summary text color or size any way to do that ,
i tried this code but it doesn't work:
<item name="android:textColorSecondary">@color/red_color</item>
any help will be appreciated, thanks
Maybe it's too late to answer, but try to remove your line of color:
<item name="android:textColor">@color/red_color</item>
And add this which are for the primary, secondary and tertiary colors
<item name="android:textColorPrimary">@color/red_color</item>
<item name="android:textColorSecondary">@color/red_color</item>
<item name="android:textColorTertiary">@color/red_color</item>
You can choose the color you want to all those, honestly, I never saw the tertiary color in any preference page, but the primary is for the main and big text, the secondary is for the small text appears below the primary.
Hope it helps.
That sucks because the xml file says it uses textColorSecondary for the summary color.
What I would recommend you do is copy and save the contents of the file above into your own project, edit that file to look the way you want it to (Remember not to change any ids), and display a custom list preference item layout.
You can apply a custom preference layout in xml like so:
<ListPreference
android:key="pref_key"
android:title="@string/my_list_preference"
android:layout="@layout/custom_list_preference" />
I put this line into styles.xml and it works:
<item name="android:textColorSecondary">#00CC00</item>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With