堆叠操作栏检测或限定符
可能的重复:
查看 ActionBar 是否堆叠
是否有任何限定符或方法如何检测,是否使用堆叠操作栏?或者您知道使用堆叠操作栏时的规则(例如特定的屏幕尺寸)吗?
堆叠操作栏如图 9 和 10 所示: http://developer.android.com/guide/topics/ui/ actionbar.html#标签
Possible Duplicate:
Find out if ActionBar is stacked
Is there any qualifier or method how to detect, if stacked action bar is used? Or do you know the rules, when the stacked action bar is used (e.g. specific screen size)?
Stacked action bar is described on figures 9 and 10:
http://developer.android.com/guide/topics/ui/actionbar.html#Tabs
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没有特定的方法(例如ActionBar.isStacked()),但您可以根据一些简单的规则做出合理的猜测。在窄设备上添加堆叠条(实际上,这通常是纵向模式的手机)。菜单项、图标和标题位于顶部栏,选项卡位于堆叠栏。正如您链接的指南中提到的,如果删除菜单项、图标和标题,顶部栏将消失,只留下堆叠栏。因此,如果您只想要一根酒吧,这将是一种可行的策略。
综上所述,如果您只是尝试使用 ActionBar 的覆盖模式,并且需要知道将内容放置多远,以便栏不会隐藏它,则 getHeight() 将返回整个栏的高度(所以如果堆叠的话两个条形都有效)。
There isn't a specific method (e.g ActionBar.isStacked()), but you can make a reasonable guess based on some simple rules. Stacked bars are added on narrow devices (in practice this is typically phones in portrait mode). The menu items, icon and Title go on the top bar, and tabs go on the stacked bar. As it mentions in the guide you linked, if you remove the menu items, icon, and title, the top bar will disappear, leaving only the stacked bar. So if you want only one bar, that would be one workable strategy.
All that said, if you're just trying to use the overlay mode of the ActionBar and need to know how far down to put your content so that the bar doesn't hide it, getHeight() will return the height for the full bar (so both bars if stacked is in effect).