0

How can we change the text color of summary of preference. right now, its taking textcolorsecondary by default which is white color. but i dont want to use it. i want to use other color. because i need textcolorsecondary for overflow and back icon color.

you can see below image where summary text not showing because of white color. enter image description here

Sagar Maiyad
  • 12,655
  • 9
  • 63
  • 99

1 Answers1

0

i just face this issue and now i find perfect solution for your problem.

here i am going to color overflow menu using styles. if you want to color preference summary text then use below code.

 <item name="android:textColorSecondary">@android:color/white</item>

the solution is quite easy. you just need to create one style(custom style) and use this styles in anywhere you want to use to show overflow menu icon (vertical three dots)color.

here is my custom style code (styles.xml) file :

 <style name="OverflowStyle" parent="Widget.AppCompat.ActionButton.Overflow">
        <item name="android:tint">#ffffff</item>
 </style>

and now use this style anywhere. right now i use in my main theme(which is appTheme)

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="actionOverflowButtonStyle">@style/OverflowStyle</item>
</style>

and for summary text of preference screen just do nothing if you want default color.

and if you want custom color then use following style attribute in your theme

<item name="android:textColorSecondary">@android:color/white</item>

and that's it .

this will give below two results. Your overflow menu icon color Your preference summary text color

Rk215 Tech
  • 532
  • 1
  • 4
  • 17