3

I'm creating an Android app for version 2.3.3 and higher (using the same SDK version) and I have used a legacy menu button.

I also have used a custom ActionBar library that doesn't have the menu overflow (?) capability. So is there any way for me to display the menu on newer Android devices without the physical menu button? Preferably without having to change the ActionBar to use another library or without having to use Android's newer SDKs?

Thanks.

4

2 回答 2

3

我已经实现了一个旧的菜单按钮

做什么的?如果您的应用程序是旧版应用程序,Android 将自行处理此问题,它会在 Honeycomb 及上方添加屏幕菜单按钮,因此您无需费心。

见这篇文章:告别菜单按钮

如果您的应用在没有专用菜单按钮的设备上运行,系统会根据您在清单元素中声明支持的 API 级别来决定是否将操作溢出添加到导航栏。逻辑归结为:

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

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

唯一的例外是,如果您将 minSdkVersion 设置为 10 或更低,将 targetSdkVersion 设置为 11、12 或 13,并且您不使用 ActionBar,则在 Android 4.0 或更高。

旧版应用程序的软菜单键如下所示:

在此处输入图像描述

于 2012-11-10T14:35:00.790 回答
0

您也可以查看我过去几天的一些答案。这两个问题都是针对ActionBarSherlock

答案 1

答案 2

注意:正如这两个答案中也提到的,我想重申一下。这只是为仍然想强制使用 OverFlow 菜单的开发人员提供一个选项。

于 2012-11-10T14:51:00.573 回答