Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android ActionBar Sherlock - Remove divider between tabs altogether

I'm trying to remove the divider between the tabs in an ActionBar (actually an ActionBarSherlock) altogether; i.e. no image between tabs and no gap between the tabs either (I'm using a tiled image background in the tabs). Ideally, I'd like the dividers removed in the XML, rather than in code.

I've tried a few approaches, but nothing seems to be working, such as:

<style name="Theme.MyTheme.ActionBarTab" parent="Widget.Sherlock.ActionBar.TabBar">
    <item name="android:divider">@null</item>
    <item name="divider">@null</item>
    <item name="actionBarDivider">@drawable/empty</item>
    <item name="android:showDividers">none</item>
</style>
like image 592
Mick Byrne Avatar asked Dec 05 '25 19:12

Mick Byrne


1 Answers

Turns out I was setting the wrong style. The android:showDividers attribute does work, but when it's applied to the style that inherits from the Widget.Sherlock.ActionBar.TabBar style. So the relevant bits of XML are:

<style name="Theme.Client" parent="Theme.Sherlock.Light.DarkActionBar">
    <item name="android:actionBarTabBarStyle">@style/Theme.Client.ActionBarTabBar</item>
    <item name="actionBarTabBarStyle">@style/Theme.Client.ActionBarTabBar</item>
</style>

<style name="Theme.Client.ActionBarTabBar" parent="Widget.Sherlock.ActionBar.TabBar">
    <item name="android:background">@drawable/tab_bar_bg_tiled</item>
    <item name="background">@drawable/tab_bar_bg_tiled</item>
    <item name="android:showDividers">none</item>
</style>
like image 156
Mick Byrne Avatar answered Dec 10 '25 01:12

Mick Byrne



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!