How to prevent actionbar tabs showing as to drop down list?

不问归期 提交于 2019-12-11 04:45:57

问题


Trying to play with default project actionbar+tabs, created by ADT plugin. On some devices tabs moved to drop-down list after screen rotation.

Android developer guide says:

Note: In some cases, the Android system will show your action bar tabs as a drop-down list in order to ensure the best fit in the action bar.

But if I want to disable this feature, and show always tabs, there is a right way to do it?


回答1:


There is no way to do it, AFAIK. I filed an issue on this very point and was told that it was working as designed.

The simplest solution, IMHO, is to not use action bar tabs, but instead switch to ViewPager and tabs for it (PagerTabStrip, tabbed indicator from ViewPagerIndicator, etc.).




回答2:


You should add the following line after adding tabs.

actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); //Important! Must be after all .addTab


来源:https://stackoverflow.com/questions/14672984/how-to-prevent-actionbar-tabs-showing-as-to-drop-down-list

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!