Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ActionBarSherlock stacked action bar styling issue

I can't figure out why the stacked ActionBar I have implemented has a gap between the left most tab and the edge of the screen.

Left most tab has left divider issue

This is not the case with the right most tab.

Right most tab does not have divider issue

I tried to remove the dividers by styling the ActionBar. After playing around with styles for a little bit, it seems like I am able to override attributes of the TabView style but not the TabBar style of ActionBarSherlock.

<style name="ActionBarTabBarStyle.Dark" parent="@style/Widget.Sherlock.ActionBar.TabBar">
    <item name="android:divider">@null</item>
    <item name="android:showDividers">none</item>
    <item name="android:dividerPadding">0dip</item>
</style>

Then I realized I need to include identical unprefixed attributes.

ActionBarSherlock Theming

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.

But I tried to include identical unprefixed attributes but that didnt work for me.

I tried to include identical unprefixed attributes.

<style name="ActionBarTabBarStyle.Dark" parent="@style/Widget.Sherlock.ActionBar.TabBar">
    <item name="android:divider">@null</item>
    <item name="android:showDividers">none</item>
    <item name="android:dividerPadding">0dip</item>
    <item name="divider">@null</item>
    <item name="showDividers">none</item>
    <item name="dividerPadding">0dip</item>
</style>

But it throws an error

Error: No resource found that matches the given name: attr 'dividerPadding'.
Error: No resource found that matches the given name: attr 'showDividers'.

So then i removed those two attributes and tried to run it again, but i still see the tabbar dividiers.

<style name="ActionBarTabBarStyle.Dark" parent="@style/Widget.Sherlock.ActionBar.TabBar">
    <item name="android:divider">@null</item>
    <item name="android:showDividers">none</item>
    <item name="android:dividerPadding">0dip</item>
    <item name="divider">@null</item>
</style>

In my AndroidManifest.xml file, I included

<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="18"/>

Any suggestions or thoughts about what may be the issue?

Update

I also tried

<style name="Theme.Dark" parent="@style/Theme.Sherlock.Light.DarkActionBar">
    <item name="actionBarDivider">@null</item>
    <item name="android:actionBarDivider">@null</item>
</style>

But this didn't remove the dividers either. Is there another attribute which overrides these attributes?

like image 763
Etienne Lawlor Avatar asked Nov 12 '22 19:11

Etienne Lawlor


1 Answers

You have to change the android:actionBarDivider attribute which belongs to the theme, not to the action bar style android:divider. You can remove the divider like this:

<style name="AppTheme" parent="Theme.Sherlock">
    <item name="actionBarDivider">@null</item>
    <item name="android:actionBarDivider">@null</item>
</style>
like image 67
Naveen Prince P Avatar answered Nov 15 '22 11:11

Naveen Prince P