Android: How to change the color of the name of a ListPreference?

I would like to change the title and row color of my ListPeference from blue to pink to match the row of my action bar.

Listpreference

Any ideas? Thanks in advance!

I am browsing Android themes.xml and styles.xml , looking at things like dialogPreferenceStyle , but haven't figured it out yet.

+6
source share
2 answers

Today we had the same problem. Old thread, but I found this: and it works fine.

Just change your styles.xml

 <resources> <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.NoActionBar"> <!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> <!-- Add this --> <item name="android:dialogTheme">@style/DialogStyle</item> <item name="android:alertDialogTheme">@style/DialogStyle</item> </style> <!-- Customize your color here --> <style name="DialogStyle" parent="android:Theme.Material.Dialog"> <item name="android:colorAccent">@color/colorAccent</item> </style> 

+5
source

Finished creating a custom ListPreference widget following this answer .

I was hoping that I could just change the style without executing my own widget, but I still didn't understand it.

+2
source

Source: https://habr.com/ru/post/956520/


All Articles