Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7669203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:32:33+00:00 2026-05-31T15:32:33+00:00

I am using ActionBarSherlock and have an ActionBar with navigation tabs in it. I

  • 0

I am using ActionBarSherlock and have an ActionBar with navigation tabs in it. I want the tabs to auto-size based on the size of the text in them, but there seems to be a style or a setting somewhere that is forcing them to use a minimum size. So for example in the screenshot the tab “Very Long Tab” has no padding (in accordance with the styling I applied) but the tabs marked “T” have a great deal of padding, despite me setting padding to 0dp.

enter image description here

As you can see below I’ve tried a brute-force approach by setting various attributes on several styles, but I’ve not succeeded yet.

How do I control the padding/width in the action bar tabs?

<style
    name="CustomActivity"
    parent="@style/Theme.Sherlock"
    >
    <item name="actionBarTabStyle">@style/customActionBarTabStyle</item>
    <item name="actionBarTabBarStyle">@style/customActionBarTabBarStyle</item>
    <item name="actionBarTabTextStyle">@style/customActionBarTabTextStyle</item>
</style>

<style name="customActionBarTabStyle" parent="style/Widget.Sherlock.ActionBar.TabView">
    <item name="android:background">@drawable/tab_indicator</item>
    <item name="android:paddingLeft">0dp</item>
    <item name="android:paddingRight">0dp</item>
    <item name="android:layout_width">wrap_content</item>
    <item name="android:minWidth">0dp</item>
</style>

<style name="customActionBarTabBarStyle" parent="style/Widget.Sherlock.ActionBar.TabBar">
    <item name="android:paddingLeft">0dp</item>
    <item name="android:paddingRight">0dp</item>
    <item name="android:layout_width">wrap_content</item>
    <item name="android:minWidth">0dp</item>
</style>

<style name="customActionBarTabTextStyle" parent="style/Widget.Sherlock.ActionBar.TabText">
    <item name="android:paddingLeft">0dp</item>
    <item name="android:paddingRight">0dp</item>
    <item name="android:layout_width">wrap_content</item>
    <item name="android:minWidth">0dp</item>
</style>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T15:32:34+00:00Added an answer on May 31, 2026 at 3:32 pm

    From that screen shot it looks like you are testing on ICS which is good since you will be observing the behavior of the native action bar rather than think it is a bug with ActionBarSherlock.

    Basically the action bar will attempt to expand tabs to take up an equal amount of space if there is enough room to do so in order to provide a cleaner look when there are only a few tabs.

    By setting the actionBarTabTextStyle padding to zero you are actually making the problem worse since now the text in the first tab has nothing around it to prevent it from touching the dividers and edge of screen. If you increase the padding (or return it to default) you should see one of two things:

    1. The text will wrap to two lines.
    2. The tab bar will convert tabs to simply be as wide as their content and allow for horizontal scrolling.

    I’m inclined to think that the former will happen due to the very thin widths of your second through fourth tab. Unfortunately this is just how the tab bar behaves and we need to just try an accomodate its behavior accordingly.

    If possible, try to create tab labels that have a more unified width which will likely trigger the second state mentioned above. Keep testing with ICS so that you can ensure the behavior you’re seeing is from the platform and then when running on pre-ICS you should get the same behavior from the library.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using ActionBarSherlock and have a little problem. In the Fragment Tabs example, there
Using ActionBar Sherlock to implements tabs, I have a new TabsAdapter object declared and
I am using ActionBarSherlock to implement action bar for Android 2.1 platform. But in
I am trying to hide the title part of my actionbar using ActionBarSherlock like
I'm adding navigation tabs to an action bar using the sample code provided here:
Using Xcode4.2.1, with a basic PhoneGap template based app. (I say template, but I
Using restlet, I want to make a post to android's c2dm service. I have
I am using actionbarsherlock library to have action-bar in my application, I am also
I am new to using the Sherlock ActionBar and I have make it run
I set up a test app using ActionbarSherlock 4.0, which works fine in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.