在 4.2 (Jelly Bean) 设备上启用菜单按钮

Enabling menu button on a 4.2 (Jelly Bean) device

我最近开始使用 Android Studio 和我从 Eclipse 环境移植的应用程序。我想要一个软菜单按钮出现在我的 4.2 平板电脑上。

已阅读 this blog post 我无法重现此行为

如果您将 minSdkVersion 或 targetSdkVersion 设置为 11 或更高,系统将不会添加旧版溢出按钮。

否则,系统将在 Android 3.0 或更高版本 运行 时添加旧版溢出按钮。

唯一的例外是,如果您将minSdkVersion设置为10或更低,将targetSdkVersion设置为11、12或13,并且您不使用ActionBar,系统将在运行时添加旧版溢出按钮您的应用在 Android 4.0 或更高版本的手机上。

我发现我必须将 targetSDK 设置为小于 11 的值,因为没有 ActionBar 的值 12 或 15 不会产生菜单按钮。

我认为博客 post 现在不正确的假设是否正确?

Am I correct in assuming that the blog post is now incorrect?

没有。这是博客post:

中的相关文章

If you set... targetSdkVersion to 11 or higher, the system will not add the legacy overflow button.

12比11高。15比11高。因此,系统不会Legacy Menu Button of Shame

as a value of 12 or 15 with no ActionBar

12 或 15 的 targetSdkVersion 默认情况下会有一个操作栏。如果您通过 NoTitleBar 主题或类似的东西抑制操作栏,这不会影响遗留菜单按钮的行为。