18

I've just used ActionBar Sherlock to implement the android action bar on pre 3.0 android devices. I'm having one issue when I'm using tab navigation though.

Currently the action bar is devided in two rows at the top of the screen. The first row contains the app icon and app title, while the second row contains my navigation tabs. I tried to remove the top bar with actionBar.setDisplayOptions(0);, but now i still have two rows, but the top row is empty. How can I remove this top row?

Thanks!

4

2 回答 2

48

我知道这是一个月前发布的,但我想我可以帮忙。在构建操作栏后尝试运行这三种方法:

    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    bar.setDisplayShowTitleEnabled(false);
    bar.setDisplayShowHomeEnabled(false);

第一个只是将 AB 设置为选项卡,我假设您已经完成了。第二个禁用顶部的字符串标题(我应该注意到它在应用程序首次启动时出现,但随后很快消失),第三个关闭图标,其功能与前一种方法相同。实际上,我的应用程序中发生了与您正在处理的相同的事情,但是一旦我运行了这两种方法,多余的空白栏就消失了。

于 2012-03-31T02:54:25.577 回答
10

除了接受的答案之外,只需删除onCreateOptionsMenuonOptionsItemSelected获得干净的标签视图,而没有任何空的操作栏。

于 2015-01-13T09:58:50.770 回答