To change the default text color of the buttons in your app so that the button text color in your app is the same everywhere, do the following:
- Go to /res/values/colors.xml
- Add the color to the colors.xml if not available as shown below
- Go to /res/values/styles.xml
- Add a new style and link it to the android:textAppearanceButton item style to the theme as shown below. Additionally, you can add button textSize.
colors.xml
<?xml version="1.0" encoding="utf-8"?> <resources> ... <color name="button_text_color">#AAAAAA</color> ... </resources>
styles.xml
<resources> <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light"> ... <item name="android:textAppearanceButton">@style/ButtonText</item> ... </style> <style name="ButtonText"> <item name="android:textColor">@color/button_text_color</item> <item name="android:textSize">16sp</item> </style>