I don't know what I did but for a period of time my TabWidget had white colored tabs which looked really nice. I never set a theme or background/foreground color in my project at all. The next time I compiled it it reverted back to the gray tabs. My application is using the default dark theme. Even if I set the application theme to light, the tabs are still gray. So obviously it was something else that changed the tabs' color. Anyone know how to do this?
A:
check this answer of mine http://stackoverflow.com/questions/2409521/background-in-tab-widget-ignore-scaling/2409745#2409745
you can also refer drawable package
By your code, u can set the background for u tabs like
tabHost.getTabWidget().getChildAt(0).setBackgroundResource(
R.drawable.color/drawable);
Praveen Chandrasekaran
2010-03-30 09:00:03
This makes the tab background black no matter what.
Kurian
2010-03-31 04:12:54
+5
A:
I was having a problem due to a bug in Android 1.6's light theme (tab indicator text is white). I was able to override the default theme as follows:
- I created a custom theme that inherited from the default theme:
styles.xml
:
<style name="MyTheme" parent="@android:style/Theme.Light">
<item name="android:tabWidgetStyle">@style/LightTabWidget</item>
</style>
<style name="LightTabWidget" parent="@android:style/Widget.TabWidget">
<!-- set textColor to red, so you can verify that it applied. -->
<item name="android:textColor">#f00</item>
</style>
Then I just apply that theme to my application by adding android:theme="@style/MyTheme"
to the <application />
element of my AndroidManifest.xml
.
Steve Pomeroy
2010-07-02 14:33:40