Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stacked ActionBar tab bar not filling parent

Tags:

I'm creating Action Bar navigation tabs, but when the Action Bar is stacked the tabs are not getting the whole width space. I have a foto to illustrate it.

enter image description here

Is possible, in this case, giving to each tab 50% of the screen width?

Thank you

I'm editing to say that it's not a Sherlock Action Bar. And I'm working in a Samsung Galaxy Note 10.1 and in a Nexus 7. And now, testing it in the Nexus, I noticed that it's behaviour is different. Another screenshot:

enter image description here

like image 370
Jon Zangitu Avatar asked Feb 20 '13 11:02

Jon Zangitu


1 Answers

I don't think that's feasible at the moment. I've been trying to do the same thing for the past few days, and here's what I have found so far.

The Android framework uses a class called ActionBarPolicy to set some rules regarding the ActionBar's behavior. In this file (which can be found here : https://github.com/android/platform_frameworks_base/blob/master/core/java/com/android/internal/view/ActionBarPolicy.java), you'll find a method called getStackedTabMaxWidth() which returns a dimen value (currently set in the ressources at 160dip).

This value is used is the inner class TabView placed in ScrollingTabContainerView (https://github.com/android/platform_frameworks_base/blob/master/core/java/com/android/internal/widget/ScrollingTabContainerView.java). TabView is the private implementation of the ActionBar's TabBar.

Now I don't think this value nor this behavior can be modified, except maybe using Reflection. I don't know enough about it to do so, so if someone could manage such a thing, don't hesitate to say so, because this really is a bad behavior which doesn't look great on some tablets.

like image 60
tkeunebr Avatar answered Oct 04 '22 23:10

tkeunebr