I am writing an application that needs the following two things:
- The general text (in
TextView
s) should be the same color (white, in this case, a dark background) Spinner
text should be in a different color (black, since white is too hard to read)
I used the theme applied at the application level in the manifest to execute the first element above.
<resources> <style name="GlobalTheme" parent="@android:style/Theme.Black.NoTitleBar.Fullscreen"> <item name="android:textColor">#FFFFFF</item> </style> </resources>
Worked great. In addition, he also makes the text on the spinner white, which is difficult to read.
OK, so I want the color video to still be black, but everything else is white.
I found this question that showed how to set the color of Spinner text, and it works, but only when I also do not set the global textColor.
So the following does not work:
<resources> <style name="GlobalTheme" parent="@android:style/Theme.Black.NoTitleBar.Fullscreen"> <item name="android:textColor">#FFFFFF</item> <item name="android:spinnerItemStyle">@style/GlobalThemeSpinnerItem</item> </style> <style name="GlobalThemeSpinnerItem" parent="android:Widget.TextView.SpinnerItem"> <item name="android:textAppearance">@style/GlobalThemeTextAppearanceSpinnerItem</item> </style> <style name="GlobalThemeTextAppearanceSpinnerItem" parent="android:TextAppearance.Widget.TextView.SpinnerItem"> <item name="android:textColor">#000000</item> </style> </resources>
I guess I was hoping it would be like CSS and everything would be cascading down (i.e. "all text should be white, except that it is in the spinner"). If I delete the android:textColor
in the main theme, the colored color trick works fine.
It seems that SpinnerItem
comes from TextView
, so I tried to find a split like textViewStyle
similar to a split spinnerItemStyle
, but no luck.
Unlike most people who ask about it, I want to save it as much as possible in XML. Does anyone know what I'm doing wrong?
Tom kidd
source share