Setting Application theme textColor to white causes Context Menu item text to be white (invisible)
Asked Answered
R

2

11

Ok, this is driving me bonkers. To skin my app, I set the following in my theme:

<item name="android:textColor">#FFFFFF</item>

All the text in the app turns white, unless I manually override it in the layout xmls. Great, yay, easy peasy. EXCEPT that the text in my menu options for context menus (off of lists and such) have also decided to become white.

This is not so great, since it is hard to read white on white. I have tried a variety of solutions, including searching for how to change the text color of a context menu (no dice)and creating a textAppearance item in my theme. The last solution didn't change all the textfields in my app, which was frustrating.

So, any suggestions? Hopefully my dilema is clear.

Revue answered 21/4, 2011 at 20:51 Comment(2)
Did you ever figure out a solution for this?Dercy
@Dercy This works for me: <style name="AppTheme.Green"> <item name="android:textColor">@color/greenTextColor</item>...Electronic
C
2

In your styles.xml try overriding the textViewStyle instead of just ALL textColor attributes:

<style name="Theme.Blundell.Light" parent="@android:style/Theme.NoTitleBar">
    <item name="android:windowBackground">@drawable/background_light</item>
    <item name="android:textViewStyle">@style/Widget.TextView.Black</item>
</style>

<style name="Widget.TextView.Black" parent="@android:style/Widget.TextView">
    <item name="android:textColor">#000000</item>
</style>

You could even take it one further and just override the color for a certain view, like buttons:

<style name="Widget.Holo.Button" parent="@android:style/Widget.Holo.Button">
    <item name="android:textColor">#FFFFFF</item>
</style>

<style name="Theme.Blundell" parent="@android:style/Theme.Holo.NoActionBar">
    <item name="android:colorBackground">@android:color/transparent</item>
    <item name="android:buttonStyle">@style/Widget.Holo.Button</item>
</style>

If your inspired to do any more theming check out the Android source it's the best place to realise what you can and can't do!:

https://github.com/android/platform_frameworks_base/tree/master/core/res/res/values

Celtuce answered 8/6, 2012 at 23:41 Comment(0)
H
0

Use this:

parent="Theme.AppCompat.Light.DarkActionBar"
Herefordshire answered 3/2, 2017 at 8:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.