在处理的Andr​​oid新版本的失踪MENU按钮(3.x和向上)新版本、按钮、oid、Andr

2023-09-05 06:41:24 作者:舂夢茽冇妳

我在安卓中所使用的菜单按钮的粉丝; 3.0,因为它是我的游戏应用程序非常有用 - 它让我把重要的,但游戏不相关的功能(节能比赛中,参考信息链接),地点它的地方,在那里没有凌乱的游戏主界面,但仍然很方便(选项菜单)。

I'm a fan of the menu button as used in Android <3.0, as it was very useful for my game apps - it allowed me to take important but gameplay irrelevant functionality (saving game, reference info links) and place it somewhere where it did not clutter up the main game interface, but was still easily accessible (the options menu).

本使用的密钥就成了问题3.0,因为它去掉了MENU键和操作栏取代它。操作栏是真的不适合游戏,喜欢全屏运行,所以这是一个真正的痛苦。无动作栏 - 选项菜单的访问权限。不过,我可以排序忽略了一段时间,因为我没有在平板电脑上,许多用户和缺乏时间来检验这一点。

This use of keys became a problem with 3.0, because it removed the MENU button and substituted it with the Action Bar. The Action bar is really not suitable for a game which likes to run full-screen, so that was a real pain. No action bar - no access to the options menu. However, I could sort of ignore it for a while, since I didn't have that many users on tablets and lacked the time to test this.

然而,ICS使这是一个严重的问题,因为MENU键显然是不回来了。现在,我不仅要处理这个问题上的平板电脑,但在手机上也是如此。

However, ICS makes this a serious issue, since the MENU button is obviously not coming back. Now I don't only have to deal with this problems on tablets, but on phones as well.

我最初的解决了这个问题一直是简单地将一个软按钮在我的GUI来取代硬盘MENU按钮

My initial solution to this problem has been to simply place a soft button in my GUI to replace the hard MENU button

this.openOptionsMenu();

和一切都恢复到ICS工作完美。

And everything is back to working perfectly in ICS.

然而,这并不对蜂窝工作。调用openOptionsMenu做,如果你没有动作条可见绝对没有。

However, this does not work on Honeycomb. Calling openOptionsMenu does absolutely nothing if you do not have the ActionBar visible.

在如何处理这有什么想法?

Any thoughts on how to deal with this?

我想我随时可以回去使用TargetSDK&LT; 11(从而迫使动作条出现在片),但据我可以看到这是仅仅推动问题走向未来,我将preFER不要做。

I suppose I could always go back to using TargetSDK < 11 (thereby forcing the ActionBar to appear on tablets), but as far as I can see this is merely pushing the problem into the future, which I would prefer not to do.

删除选项菜单完全消失,而过去只有使用上下文菜单? [澄清:我的意思,而不是打开一个选项菜单 - 我只使用上下文菜单,因为 - 至少从目前来看 - 在所有设备上这些工作。

Drop the Options Menu entirely, and go over to only using Context Menus? [Clarification: By this I mean that instead of opening an options menu - I only use context menus since - at least for now - these work on all devices].

兴趣听别人谁曾与整个选项菜单类似问题/动作条乱七八糟决定这样做。

Interested in hearing what others who have had similar issues with the whole Options Menu/ActionBar mess decided to do.

推荐答案

让我分享另一个场景菜单按钮就显得至关重要,虽然它不是一个游戏。

Let me share another scenario where Menu Button becomes critical even though it is not a game.

我的应用程序实现自己的工具栏,它们的行为像动作条在一定程度上。嗯,我这样做,怎么把我的应用程序是与1.5 SDK发布。当时没有这样的概念。而且,以适应我的工具栏我隐藏默认的标题栏。但一些动作都是通过菜单功能完成的。

I have app implement its own tool bars which behave to some extent like ActionBar. Well I did that coz my app was released with 1.5 sdk. At that time there is no such concept. And to accomodate for my toolbars i hide the default title bar. But some of the actions are done through Menu functionality.

现在因为Galaxy Nexus的存在,如果你不使用动作条,并且是伤害我,因为我的应用程序还支持1.5没有菜单按钮。

Now since in Galaxy Nexus there is no Menu button if you are not using ActionBar and that is hurting me because my app still supports 1.5.

那么有各种变通,但没有一个是容易的。

Well there are various work arounds, but none is easy.

这是说,我周围想出的唯一工作就是给用户我的工具栏上的所有选项,所以没有必要菜单的。我能做到这一点,因为我只有两个动作不属于工具栏的一部分。

That said, the only work around I come up with is to give user all options on my toolbar, so there is no need for Menu at all. I can do this because i only have two actions which are not part of the toolbar.

在你的情况,一个按钮上下文菜单是不是一个坏SOLN在游戏中的游戏将在它运行相比,具有对列表中的项目上下文菜单中,每一个产品不同的上下文中只有一个背景。

In your situation, context menu on a button is not a bad soln in a game as game will have only one context in which it is running as compared to having context menu on list items where every item is a different context.

顺便说一句,如果 openOptionsMenu 适用于ICS,你可以在一段时间后沟蜂窝(即使是现在的用户群是太低了),然后尝试给这两个菜单的

BTW if openOptionsMenu works on ICS and you can ditch HoneyComb after a while (even now the userbase is too low) then try giving both menus based on the version.

编辑:那么还有另一种方式也得到了菜单S / W按钮,在下面的导航栏。只需设置 targetSdkVersion 不到11详情请阅读整个氛围中

Well there is another way also to get the MENU s/w button in the below navigation bar. Just set the targetSdkVersion to less than 11. For more details pls read the whole soln.