问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/7688854/honeycomb-themes-noactionbar-or-notitlebar-where-is-menu-button