Question

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?

Was it helpful?

Solution 2

I will accept anyone with an answer that involves keeping ActionBarSherlock, however, I removed this library and now I am just using the support libraries and am no longer having that spacing issue. I guess there might be an issue with ActionBarSherlock. But since it is no longer being supported I think the best solution is just to use the Support libraries.

OTHER TIPS

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>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top