Stacked ActionBar tab bar not filling parent

后端 未结 2 359
暗喜
暗喜 2021-01-01 11:21

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.

2条回答
  •  失恋的感觉
    2021-01-01 11:42

    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.

提交回复
热议问题