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.
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:
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With