Custom style for a stacked action bar?

I want to have separate backgrounds for stacked and non-stacked tabs.

This should explain this:

enter image description here

So I have this:

For tablets, use the dark background tabs. For everything else, use a light background.

This applies to most use cases, but I would like it to not look bad in the telephone landscape.

Anyway, can I do this? A style modifier that I skipped maybe?

+7
source share
1 answer

You can change the background of the tab depending on the complex / non-stacked ActionBar by setting the background highlighting only for android:backgroundStacked in your theme.

But then you ran into a problem that you cannot determine the color of the tab text based on tiered layout. This means that the result is either light text on a light background or dark text on a dark background.

This is an already registered issue: http://code.google.com/p/android/issues/detail?id=26557 , so your options now either wait or use one of these workarounds:

PS I also encounter this problem as I have a dark ActionBar with light tabs in my application. Still have not found the perfect solution.

A little off topic: If you havenโ€™t already done so, use the Action Style Style Generator to make it easier to handle colors and patterns. Again, you will not find a satisfactory configuration for a dark action bar with a lightly laid out tab bar.

+8
source

All Articles