2

I am building an app that uses ActionBarSherlock. I need to change it's layout so there is no padding arround tab icons. Now it looks like that:

| tab1 |  tab2 | tab3 | t    

But i want it like that:

 |tab1|tab2|tab3|tab4|

I've manage to do so on normal size screens by changing that file:

 library/res/values/abs__styles.xml

However on my Galaxy S3 still has padding, I tried changing paddings from:

  library/res/values-xlarge/abs__dimens.xml

but no effect. I also tried to remove it but still no changes.

edit:

Just for information, I am using only icons but no text for top. All my icons are in drawable-hdpi, could that be a problem? I don't think so because they are not reseized or anything only paddings apper :S

that one is in values.

so I also tried comment out all lines with

<dimen name="abs__action_bar_icon_vertical_padding">0dip</dimen>

but no effect…

Ragunath Jawahar
  • 19,513
  • 22
  • 110
  • 155
gabrjan
  • 3,080
  • 9
  • 40
  • 69

4 Answers4

2

If your Galaxy S3 is running ICS or later, ABS will use the native action bar. Any changes you make to the library will have no effect.

Nikolay Elenkov
  • 52,576
  • 10
  • 84
  • 84
  • OK, that's usefull information it's running 4.0.3 so it's ICS. Any idea how to remove paddings with native action bar? – gabrjan Oct 23 '12 at 08:20
  • Create your own ROM? Not really possible otherwise. – Nikolay Elenkov Oct 23 '12 at 08:21
  • ROM? U mean i create a whole class that overrides native action bar? Well i'm using ABS so i don't need to do that :S – gabrjan Oct 23 '12 at 08:22
  • No, I mean modify the Android OS and install it on your phone. Those are system resources and cannot be modified by apps. You could also try to hack ABS to *not* use the native AB, but that would probably be a bad idea. – Nikolay Elenkov Oct 23 '12 at 08:23
  • Well that app is going to be for multiple users so no way i change evrybody's ROM. So i guess there is only changing ABS :S – gabrjan Oct 23 '12 at 08:33
  • Or forget about this, and make your app consistent with the platform look and feel. Your users will thank you. – Nikolay Elenkov Oct 23 '12 at 08:34
  • well my app is quite Ok i think i just realy hate that scrolling... So a sollution for that would be wonderfull, however it's not so big of a deal but my employer hates it too :S – gabrjan Oct 23 '12 at 08:41
  • Well, show them this and be persuasive :) http://developer.android.com/design/building-blocks/tabs.html – Nikolay Elenkov Oct 23 '12 at 08:43
  • LOL, so if android says so it is so :D, i guess i'm gonna try to find how to set those paddings programaticly... – gabrjan Oct 23 '12 at 08:53
2

Action Bar Sherlock library has some limitations in it.

Limitation 1 : Adjusting of Action menu items in action bar is not possible

Description : You can have different action menu items in the action bar and also you can set the icons for that items in the action bar. But, adjusting padding between action items, Removing Toast for the action items in the action bar it is impossible. Because Action bar Sherlock uses native action bar. Only look and feel is similar to ICS, but behavior is restricted.

Limitation 2 : Activity Recreation

Description : When Screen orientation changes, It will recreate activity which is in active. So User Interface will get updated and also it doesn't save the state of the application or activity.. Be Aware of Action Bar Sherlock

RajeshVijayakumar
  • 10,281
  • 11
  • 57
  • 84
1

I wouldn't use ABS directly for Tab navigation. Consider using a Viewpager and ViewPagerIndicator, which is comatible with ABS (same author), and there you have a lot more control of the appearance . This way the user can also swip left-right to switch tabs.

stoilkov
  • 1,686
  • 1
  • 11
  • 18
  • do u have any idea how long would it take to do sow? Because i'm working on a project and it's in final state... – gabrjan Oct 30 '12 at 08:00
  • It's definitely much less effort than using the native tabs. you should bare in mind that the tab navigation in the ASB examples is not part of ASB itself, and as such looks "native" (remeber pre-ics tabs?). VPI now has a IconPageIndicator, so you can also have icons for the tabs. Take a look at the samples of VPI they are pretty self-explanatory: https://github.com/JakeWharton/Android-ViewPagerIndicator/tree/master/sample – stoilkov Oct 30 '12 at 08:16
  • well there are some other problems i'm using sherlockmapactivity because there is map in my app, so i can't just ignore that library. And when i have one library named library i cant import another one. – gabrjan Oct 30 '12 at 08:41
  • Who said, it should be called library? You can rename always rename them. What you should be careful about is the compatibility library, they all should use the same version and same file. – stoilkov Oct 30 '12 at 08:49
1

Does this happen no matter what? I honestly haven't played too much with a native actionbar. What if you do something like an inset drawable? This would kind-of change how it's drawn and may shrink the icon, but might be a solution until you find something better.

Joe Plante
  • 6,308
  • 2
  • 30
  • 23