蜂窝主题 *.NoActionBar 或 *.NoTitleBar - 菜单按钮在哪里?
我的清单设置: targetSdkVersion=11
我的活动主题设置为 android:style/Theme.Holo.NoActionBar 或 android:style/Theme.NoTitleBar
期望的结果:应用程序不显示顶部栏(操作栏或标题栏),并且有菜单。我想要几乎全屏(视频播放器或图像查看器),可能状态栏变暗。
问题是,在这种组合中,无法按下菜单按钮,因为没有显示菜单按钮。 如果 targetSdkVersion <11,则底部栏上有旧版菜单按钮,如果我选择隐藏操作栏,我希望该按钮会出现在那里。
平板电脑上没有硬件菜单按钮,没有上述条件的虚拟菜单按钮。
难道是 Honeycomb 上的一些设计错误迫使所有应用程序都必须有操作栏才能有菜单吗?
有几个具有 .NoActionBar 版本的 Holo.* 主题,这些主题是否应该仅适用于没有菜单的应用程序?
我很困惑如果我选择没有操作栏,为什么菜单按钮不会移动到底部栏。
问题:当我的应用程序定位到 Honeycomb 时,我是否可以没有操作栏并仍然提供菜单?
My manifest setup:
targetSdkVersion=11
I have Activity with theme set to android:style/Theme.Holo.NoActionBar or android:style/Theme.NoTitleBar
Desired result: app that doesn't show top bar (action bar or title bar), and has menu. I want almost full screen (video player or image viewer) possibly with dimmed status bar.
Problem is that in such combination, there's no way to push menu button, because there's no Menu button shown.
If targetSdkVersion is <11, then there's legacy Menu button at bottom bar, which I would expect to be there if I choose to hide Action bar.
There's no hardware menu button on tablets, there's no virtual menu button with above condition.
Is it some design fault on Honeycomb, that forces all apps to have Action bar in order to have menus?
There're several Holo.* themes with .NoActionBar version, are these supposed to be only for apps that have no menu?
I'm confused why menu button is not moved to bottom bar if I choose not to have action bar.
Question: can I have no action bar and still offer menu while targeting my app to Honeycomb?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您需要菜单,请使用操作栏或创建您自己的菜单系统。 Honeycomb 就是这样,这不是设计缺陷,而是设计选择。
你可以做的就是隐藏操作栏;查看这个答案,了解如何实现此类目标。例如,一个不错的策略是,如果没有用户活动(基本上发生触摸事件),则隐藏操作栏。您可以设置一个计时器,在触摸事件发生 2 秒后将其隐藏,并在同时发生触摸时取消计时器。如果有触摸,同样再次显示。
If you want a menu, either use the action bar or create your own menu system. Thats how it is in Honeycomb, and not a design flaw but a design choice.
What you could do is hide the action bar instead; Check this answer on how to achieve such things. A nice strategy for example would be to hide the action bar if theres no user activity (touch events happening basically). You could set a timer to hide it after 2 seconds upon touchUp events and cancel the timer if there is a touch in the meantime. Similarly show it again if there are touches.