Reputation: 93
I am currently making an app (Android 1.6) that can change between two different themes. I made a custom theme that takes the Android light theme as a parent! The trouble is that when I switch to white theme my text is not drawn but if I select something I can see the text. Furthermore when I switch themes my titleText, previous and next are the same as in my dark theme.
Here is the code I use for the theme:
<style name="Theme.White" parent="android:Theme.Light">
<item name="android:colorBackground">@color/text_color_dark</item>
<item name="android:textColor">@color/text_color_dark</item>
<item name="textPrev">@style/text_prev</item>
<item name="textRegular">@style/text_regular</item>
<item name="textTitle">@style/text_title</item>
<item name="textNext">@style/text_next</item>
<item name="pageBack">@style/page_back</item>
<item name="whiteBack">@style/white_back</item>
<item name="android:textColorPrimaryInverse">@android:color/primary_text_light</item>
</style>
</resources>
This is my style:
<style name="text_prev">
<item name="android:textColor">@color/text_color</item>
</style>
<style name="text_next">
<item name="android:textColor">@color/default_text_color_2</item>
</style>
<style name="text_regular">
<item name="android:textColor">@color/text_color_dark</item>
</style>
<style name="text_title">
<item name="android:textColor">@color/text_color_dark</item>
</style>
<style name="page_back">
<item name="android:background">@drawable/white_background</item>
</style>
<style name="white_back">
<item name="android:background">@drawable/white_container</item>
<item name="android:padding">10sp</item>
</style>
I use two more resources that are in my res/drawable folder. Everything works fine in the standard theme, but as soon as I switch to my light theme my text disappears. Is there something that I'm doing wrong?
Upvotes: 3
Views: 1222
Reputation: 3756
From your code snippet above you're setting both background and text to the same color i.e. "color/text_color_dark", these should be different.
<item name="android:colorBackground">@color/text_color_dark</item>
<item name="android:textColor">@color/text_color_dark</item>
Upvotes: 1