Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
321 views
in Technique[技术] by (71.8m points)

android - Only display tabs in action bar

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!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...