1

On Android 4.x I want to change the default color (here is blue) when an item is pressed in Preference: enter image description here

How can I do that? Thank you very much guys!

anthony
  • 7,653
  • 8
  • 49
  • 101
  • Possible duplicate of [Change the color of a checked menu item in a navigation drawer](https://stackoverflow.com/questions/30886453/change-the-color-of-a-checked-menu-item-in-a-navigation-drawer) – Wei May 29 '17 at 08:45
  • show us your them ? backround color might work in this situation – Sushant Gosavi May 29 '17 at 09:20

1 Answers1

0

You should redefine the color accent for Preferences in your styles.xml for example:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        // your relevant items 
        <item name="preferenceTheme">@style/PreferenceTheme</item>
    </style>


   <style name="PreferenceTheme" parent="@style/PreferenceThemeOverlay.v14.Material">  
        <item name="colorAccent">@color/colorAccent</item> // here for the ripple color
        <item name="android:textColorPrimary">@color/textColorPrimary</item>
        <item name="android:textColorSecondary">@color/textColorSecondary</item> 

    </style>
</resources>

parent="@style/PreferenceThemeOverlay.v14.Material" it is to get a material style like , you can use this parent by addind in your build.gradle : compile 'com.android.support:preference-v14:25.3.1'

Sorry for my english.

Hope this help .

Cochi
  • 2,199
  • 2
  • 12
  • 15