Rohan
Rohan

Reputation: 1190

How do I set text color when using PreferenceFragmentCompat?

I am overriding the PreferenceFragmentCompat class from the v7 support library to provide a settings screen in my application. I need to set the text color of the items in the PreferenceScreen.

This is what I have tried (in styles.xml) -

<style name="AppTheme.Preference" parent="@style/PreferenceThemeOverlay">
    <item name="android:textColor">@android:color/holo_red_dark</item>
</style>

<style name="AppTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="preferenceTheme">@style/AppTheme.Preference</item>
</style>

But this doesn't change the color. How do I go about setting the preference screen text color ?

Upvotes: 3

Views: 1089

Answers (1)

Rohan
Rohan

Reputation: 1190

I fixed it by using android:textColorPrimary instead of android:textColor.

Upvotes: 5

Related Questions