Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android ActionBar Tabs background color split mode

Hee,

First of all I want to say that I am using ActionBarSherlock (the screenshots are taken on a Samsung Galaxy S3).

I have an actionbar with a tabbar in it, I want that the tabbar has a grey color when it is splitted (the tabbar is underneath the actionbar) and a transparant color (or same color as actionbar background) when the tabbar is inside the actionbar.

Here is a little code snippit of my styles.xml:

<style name="Theme.OSP.Light" parent="@style/Theme.Sherlock.Light">
        <item name="actionBarStyle">@style/Widget.Styled.ActionBar</item>
        <item name="android:actionBarStyle">@style/Widget.Styled.ActionBar</item>

        <item name="actionBarTabBarStyle">@style/Widget.Styled.ActionBar.TabBar</item>
        <item name="android:actionBarTabBarStyle">@style/Widget.Styled.ActionBar.TabBar</item>
    </style>

    <style name="Widget.Styled.ActionBar" parent="Widget.Sherlock.Light.ActionBar">        
        <item name="android:background">#F0F0F0</item>
        <item name="background">#F0F0F0</item>
    </style>

    <style name="Widget.Styled.ActionBar.TabBar" parent="Widget.Sherlock.Light.ActionBar.TabBar">
        <item name="android:background">#E0E0E0</item>
        <item name="android:gravity">center</item>
    </style>

Below are some screenshots to make my question more clear.

Landscape (actionbar not splitted). This is not OK, the tabbar should have the same color as the actionbar, but instead it has the same grey color: Landscape (actionbar is not splitted)

Portrait (actionbar splitted). This is OK, the tabbar has a grey color in this state: Portrait (actionbar is splitted)

like image 396
Steffen Brem Avatar asked Sep 06 '12 10:09

Steffen Brem


1 Answers

I've found a wonderful website were you can generate an android theme in seconds! This solved all my problems:

http://jgilfelt.github.com/android-actionbarstylegenerator/

EDIT

Also see the following link for a working answer: Change ActionBar Tabs background color

like image 71
Steffen Brem Avatar answered Oct 13 '22 21:10

Steffen Brem