Search code examples
androidmaterial-designandroid-buttonmaterial-componentsmaterial-components-android

How to change android button text color globally in theme


How can I change all my buttons text color?

I know I can set the background color like follows :

<style name="AppTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
    ...
    <item name="colorButtonNormal">@color/buttonColor</item>
</style>

How can I do this for the button Text?


Solution

  •  <style name="AppTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
       <item name="android:textColor">#yourcolor</item>
        <item name="android:buttonStyle">@style/ButtonColor</item>
        <item name="colorButtonNormal">@color/buttonColor</item>
    </style>
    
    
    
    <style name="ButtonColor" parent="@android:style/Widget.Button">
       <item name="android:textColor">@color/yourcolor</item>
    </style> 
    

    android:textColor This should help you change the text color globally.