Can Poyrazoğlu
Can Poyrazoğlu

Reputation: 34830

How to hide just the pager tabs (but not the action bar) in Android

I'm using ViewPager to display tabs in Android, but in a circumstance, I want to display a fragment on top of the pager/tabs, but NOT on top of the ActionBar. If I hide the action bar, they both disappear. If I don't do it, I can't find a way to get rid of pager's tab bar (or whatever it's called). Here is a visual representation of what I'm trying to achieve:

enter image description here

How can I hide that bar without hiding the action bar?

Upvotes: 0

Views: 466

Answers (2)

arlistan
arlistan

Reputation: 741

I think you can do it by setting a new navigation mode.

Use setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD) to hide them

Use setNavigationMode(ActionBar.NAVIGATION_MODE_TABS) to show them again

Edit:

Please note that the setNavigationMode methods are deprecated in Android Lollipop. Reference

Upvotes: 1

Fahim
Fahim

Reputation: 12378

Use this to get rid of tabs in actionbar

setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD)

Upvotes: 1

Related Questions