菜单按钮不会在Nexus 7保护展示会在、按钮、菜单、Nexus

2023-09-05 06:58:53 作者:沉寂于曾经

让我面对这个问题很长一段时间。我得的Nexus 4和Nexus 7都运行的Andr​​oid 4.3,我已经得到了应用程序targetSdkVersion =11(我用11,因为低于11的任何目标SDK不支持多点触控对我来说)。而问题是这3点的菜单显示在Nexus 4,但犯规秀上的Nexus 7。3点菜单按钮上的关系只有7个作品,如果我把targetSdkVersion =8,但随后多点触控不工作

so I am facing this problem for long time. I've got Nexus 4 and Nexus 7 both running Android 4.3, and i've got application with targetSdkVersion="11"("I use 11 because any target sdk below 11 doesn't support multitouch for me). And the problem is that 3-dot menu shows on Nexus 4 but doesnt show on Nexus 7. 3 dot menu button on nexus 7 works only if I put targetSdkVersion="8" but then multitouch doesnt work

的Nexus 4:

Nexus 4:

的Nexus 7:

Nexus 7 :

code:

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="11" />

截图: 承上启下7

screenshots : nexus 7

承上启下4:

nexus 4:

推荐答案

如果你特别想知道为什么不被显示的按钮下面的规则,当Android的决定是否需要一个传统的菜单键:

In case you are specifically wondering why the button is not being shown the following rules apply when Android determines if a legacy menu button is needed:

如果目标API版本低于11则显示在所有设备 如果目标版本是11,12或13(即平板电脑仅蜂窝)的Andr​​oid假设你的应用程序是专为平板电脑而不会显示在平板电脑上的传统按键,而是将在手机上 如果目标是14或以上(ICS及以上)的Andr​​oid假设你的应用程序是专为平板电脑和手机等传统按钮不会显示。

但是,像其他的答案说,你不应该使用这个菜单按钮。如果你不希望整个动作条,另一种选择是让你的活性三个点的按钮​​,这显示了使用菜单PopupMenu.

But like the other answers say, you shouldn't be using this menu button. If you don't want an entire ActionBar, another option would to have a three-dot button in your activity which shows a menu using PopupMenu.