[英]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. 我正在使用ViewPager在Android中显示选项卡,但是在某种情况下,我想在分页器/选项卡的顶部显示一个片段,而不是在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:
这是我要实现的目标的直观表示:
How can I hide that bar without hiding the action bar? 如何隐藏该栏而不隐藏操作栏?
使用它摆脱操作栏中的标签
setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD)
I think you can do it by setting a new navigation mode. 我认为您可以通过设置新的导航模式来做到这一点。
Use setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD)
to hide them 使用
setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD)
隐藏它们
Use setNavigationMode(ActionBar.NAVIGATION_MODE_TABS)
to show them again 使用
setNavigationMode(ActionBar.NAVIGATION_MODE_TABS)
再次显示它们
Edit: 编辑:
Please note that the setNavigationMode
methods are deprecated in Android Lollipop. 请注意,Android Lollipop不推荐使用
setNavigationMode
方法。 Reference 参考
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.