I want to have separate backgrounds for stacked and non-stacked tab bars.
This should explain it:
So the way I have it is:
For tablets, use dark background tabs. For everything else, use light background.
This covers most use cases, but I'd like to make it not look bad in phone-landscape.
Any way I can do this? A style modifier I missed, maybe?
You can change the tab background depending on stacked/non-stacked ActionBar by setting the light background drawable only for android:backgroundStacked
in your theme.
But then you run into the problem that you can't define the tab text color based on stacked/non-stacked layout. That means, the result is either light text on light background or dark text on dark background.
This is already a registered issue: http://code.google.com/p/android/issues/detail?id=26557, so your options now are either waiting or using one of these workarounds:
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS)
but sticking with old-school TabHost or other navigation approaches such as ViewPagerIndicator (also supporting tabs)P.S. I'm also facing this issue as I have a dark ActionBar with light tabs in my app. Still haven't found the perfect solution.
A little off-topic: If you haven't already, use the Action Bar Style Generator to deal with colors and drawables easier. Again, you'll find no satisfactory configuration for a dark action bar with a light stacked tab bar.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With