Only display tabs in action bar

前端 未结 2 1035
栀梦
栀梦 2020-12-14 18:55

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.

Curre

相关标签:
2条回答
  • 2020-12-14 19:14

    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.

    0 讨论(0)
  • 2020-12-14 19:31

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

    0 讨论(0)
提交回复
热议问题