问题
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.
回答1:
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.
回答2:
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.
回答3:
Assign color to button text
<Button android:textColor="#FFFFFF"></Button>
来源:https://stackoverflow.com/questions/13142098/how-to-change-default-color-in-all-texts-in-my-android-application