Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: How do you hide Tabs in the ActionBar?

I need to temporarily hide the Tab objects I've defined for my ActionBar. There is no setVisibility method on Tab objects, so I'm at a loss as to how to accomplish this.

like image 988
Christopher Perry Avatar asked Sep 22 '11 23:09

Christopher Perry


People also ask

How to Hide the toolbar in Android?

If you want to hide Action Bar from the entire application (from all Activities and fragments), then you can use this method. Just go to res -> values -> styles. xml and change the base application to “Theme. AppCompat.

How do I hide support action bar?

Hide the Status Bar on Android 4. getDecorView(); // Hide the status bar. // status bar is hidden, so hide that too if necessary. ActionBar actionBar = getActionBar();


1 Answers

I'd try setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD), to move back to the non-tab rendition. It's possible that, when you later call setNavigationMode(ActionBar.NAVIGATION_MODE_TABS) that you will need to re-establish your tabs, though.

UPDATE: Note that action bar tabs are deprecated in the "L" Developer Preview and should remain deprecated in future production Android releases. Consider using something else for tabs: ViewPager with a tabbed indicator, FragmentTabHost, etc.

like image 173
CommonsWare Avatar answered Oct 31 '22 16:10

CommonsWare