ActionbarSherlock: Hide actionbar while displaying tabs

淺唱寂寞╮ 提交于 2020-01-13 05:12:08

问题


My UI uses ABS with tabs (ActionBar.NAVIGATION_MODE_TABS) and a bunch of fragment layouts being loaded for each tab.

There is one tab where I need to hide the ActionBar (to reclaim some screen space) for the UI but calling getSupportActionBar().hide(); would nuke the tabs along with the ActionBar.

I was wondering if there is was anyway at all where I could hide the actionbar without affecting the tabs?

EDIT: Actually, come to think of it, the Actionbar doesn't do anything except showing the app branding/icon. So I wouldn't mind hiding the ActionBar altogether and just showing the tabs.


回答1:


This is called a 'collapsed action bar'. It will be automatically hidden if you don't display the title and the home icon:

 getSupportActionBar().setDisplayShowHomeEnabled(false);
 getSupportActionBar().setDisplayShowTitleEnabled(false);

If you want to have both tabs and actions, you can use a split action bar and have the actions (menus) at the bottom.



来源:https://stackoverflow.com/questions/12928092/actionbarsherlock-hide-actionbar-while-displaying-tabs

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