且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何添加软件键盘上的MENU按钮

更新时间:2023-02-08 21:08:04

对于初学者来说,你会得到很多人在这里告诉你,这是一个坏主意,和一个老UI模式。他们是对的...

For starters, you will get a lot of people telling you here that this is a bad idea, and an old UI pattern. They are right...

下面是我的一个相关的问题的答案 - 也大量关于该主题的其他意见(一些很有趣):

Here is my answer on a related question - and also lots of other opinions on the topic (some quite amusing):

  • Show options menu button on Galaxy Nexus (Android 4.1)

我特别喜欢的殇兼容性菜单的参考,从 @ nicopico的回答

I particularly enjoy Compatibility Menu of Shame reference from @nicopico's answer.

请考虑,如果你真的想 - 只有在极端情况下使用,如可能你的客户是坚持。否则,避免了这种模式。

Please consider if you really want it - only use in extreme cases, like maybe your client is insisting. Otherwise avoid this pattern.

您可以设置您的构建目标来之前ICS版本(即直至并包括13 API /蜂巢3.2)。

You can set your build target to a version before ICS (i.e. up to and including API 13 / HoneyComb 3.2).

<uses-sdk
    android:minSdkVersion="7"
    android:targetSdkVersion="13" />

这将得到系统使用,把一个图标到您手机的底部按钮栏兼容模式设置 - 这应该提供你所追求的功能。 pressing此按钮将作为$ P $相同的响应pssing对三星Galaxy S2一个菜单按钮,例如。

That will get the system to use a compatibility mode setting that inserts an overflow icon into your phone's bottom button bar - this should provide the functionality you are after. Pressing this button will have the same response as pressing a "menu" button on the Samsung Galaxy S2 for example.

在这里,您可以看到兼容性选项按钮,当它已经显示的菜单pressed:

Here you can see the compatibility "options" button, and the menu that has been shown when it was pressed:

如何添加软件键盘上的MENU按钮

至于其他评论提到,你应该考虑更好的选择动作条格局。如果你想向后兼容性,那么我建议的操作栏福尔摩斯库。

As other commentators mention, you should consider the better choice of the ActionBar pattern. If you want backwards compatibility, then I recommend the Action Bar Sherlock library.

但是,如果你正在寻找一种快速解决,或者客户端无法承受大的重构移动到操作栏模式,那么这是做它的方式。

But if you are looking for a quick fix, or the client can't afford a big refactor to move to the Action Bar pattern, then this is the way to do it.