Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Actionbarsherlock - change actionbar line colour

I am currently working on making my application compatible with pre 3.0 devices with the aid of actionbarsherlock. My application has a custom theme which overide Holo.light changing the blue to orange.

I am wanting to change the blue line which appears under the actionbar to orange. With the official actionbar I managed this by overriding

    <item name="android:background">@drawable/ad_tab_unselected_holo</item>

Unfortunately this does not seem to be working in actionbarsherlock 4.

like image 257
bencallis Avatar asked Apr 06 '12 13:04

bencallis


1 Answers

You need to do two things:

The ABS 4 now mimics the standard Action bar with its attributes so you need to add -

<item name="background">@drawable/ad_tab_unselected_holo</item>

Notice the absence of android:

So your overall code would be:

<item name="android:background">@drawable/ad_tab_unselected_holo</item>
<item name="background">@drawable/ad_tab_unselected_holo</item>

To quote:

Due to limitations in Android's theming system any theme customizations must be declared in two attributes. The normal android-prefixed attributes apply the theme to the native action bar and the unprefixed attributes are for the custom implementation. Since both theming APIs are exactly the same you need only reference your customizations twice rather than having to implement them twice.

I would also extend a varient of Theme.Sherlock rather than holo, as I believe holo is not available on older devices that are pre 3.0.

like image 168
Graham Smith Avatar answered Oct 05 '22 05:10

Graham Smith