I would like to change all color texts in my application. So I wrote this code and I set my theme in the manifest:
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<item name="android:textColor">@color/white</item>
</style>
But only TextView texts are in white. I would like Button and EditText to be in white too.
Can anyone help me? Thank you in advance.
In XML, we can set a text color by the textColor attribute, like android:textColor="#FF0000" .
Your Theme:
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<item name="android:textColor">@color/white</item>
<item name="android:buttonStyle">@style/ButtonTheme</item>
</style>
And this is how you can set your Button Theme:
<style name="ButtonTheme" parent="android:style/Widget.Button">
<item name="android:textColor">@color/white</item>
</style>
And also do this with EditTexts etc.
I think most of the widget styles build off of these:
<item name="android:textColorPrimary">@android:color/primary_text_dark</item>
<item name="android:textColorSecondary">@android:color/secondary_text_dark</item>
<item name="android:textColorTertiary">@android:color/tertiary_text_dark</item>
<item name="android:textColorPrimaryInverse">@android:color/primary_text_light</item>
<item name="android:textColorSecondaryInverse">@android:color/secondary_text_light</item>
<item name="android:textColorTertiaryInverse">@android:color/tertiary_text_light</item>
<item name="android:textColorPrimaryDisableOnly">@android:color/primary_text_dark_disable_only</item>
<item name="android:textColorPrimaryInverseDisableOnly">@android:color/primary_text_light_disable_only</item>
<item name="android:textColorPrimaryNoDisable">@android:color/primary_text_dark_nodisable</item>
<item name="android:textColorSecondaryNoDisable">@android:color/secondary_text_dark_nodisable</item>
<item name="android:textColorPrimaryInverseNoDisable">@android:color/primary_text_light_nodisable</item>
<item name="android:textColorSecondaryInverseNoDisable">@android:color/secondary_text_light_nodisable</item>
<item name="android:textColorHint">@android:color/hint_foreground_dark</item>
<item name="android:textColorHintInverse">@android:color/hint_foreground_light</item>
<item name="android:textColorSearchUrl">@android:color/search_url_text</item>
Override the values as needed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With