質問

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!

役に立ちましたか?

解決

I recognize this was posted about a month ago, but I think I can lend a hand. Try running these three methods just after constructing your action bar:

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

The first just sets the AB to tabs, which I assume you've already done. The second disables the String title up top (I should note that it appears when the app first launches, but then disappears very quickly), and the third shuts off the icon with the same functionality as the previous method. I actually had the same thing you're dealing with occur in my app, but once I ran both of those methods, the extra, and blank, top-most bar disappeared.

他のヒント

In addition to the accepted answer, Just remove onCreateOptionsMenu and onOptionsItemSelected to get clean tab view without having any empty action bar.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top