Android Coding

How to change the global default text color of an app on Android?

3 views September 21, 2018 September 21, 2018 bicobro 0

To change the default text color of your app so that the text color in your app is the same everywhere, do the following:

  1. Go to /res/values/colors.xml
  2. Add the color to the colors.xml if not available as shown below
  3. Go to /res/values/styles.xml
  4. Add the android:textColorTertiary item style to the theme as shown below. Optionally you can add the textColorPrimary and textColorTertiary as well:

colors.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    ...
    <color name="text_color_primary">#111111</color>
    <color name="text_color_secondary">#222222</color>
    <color name="text_color_tertiary">#333333</color>
    ...
</resources>

styles.xml

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light">
        ...
        <item name="android:textColorPrimary">@color/text_color_primary</item>
        <item name="android:textColorSecondary">@color/text_color_secondary</item>
        <item name="android:textColorTertiary">@color/text_color_tertiary</item>
        ...
    </style>

 

Was this helpful?