候补hasPermanentMenuKey()为Android 2.3.3 [英] Alternate to hasPermanentMenuKey() for Android 2.3.3

查看:408
本文介绍了候补hasPermanentMenuKey()为Android 2.3.3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建设我的应用程序API 10级。但它可以安装,并在以后的版本中使用。我需要显示操作栏只有当设备没有菜单按钮。例如片剂,谷歌的Galaxy Nexus手机,等人建议使用hasPermanentMenuKey()函数。但是,只有在API级别14我猜是可用的。任何人都可以建议我如何解决这个问题呢?

I am building my App with API level 10. But it can be installed and used in later versions. I need to show Action Bar only if the device does not have menu button. For Example, Tablets, Google Galaxy Nexus Phone, etc. People suggest to use hasPermanentMenuKey() function. But it is available only after API level 14 I guess. Can anyone suggest me how to get around this issue?

谢谢,
KARTHIK

Thanks, Karthik

推荐答案

使用下面code:

ViewConfiguration.get(context).hasPermanentMenuKey();

首先设置您的构建目标的 API级别14或UP 使用上述code,同时将从获得任何错误停止的Eclipse。

First set your build target to API level 14 or UP that will stop Eclipse from getting Any Error while Using above code.

立即检查你的API级别

案例1 如果你的API层次: 10,少

Case 1. if your API level : 10 and less

该设备确实有硬件菜单按钮。

the device does have hardware menu button.

案例2 如果你的API层次: 11〜13(蜂巢)

Case 2. if your API level : 11 to 13(HoneyComb)

该设备不具有HW MENU键,因为蜂窝片
  没有菜单。

the device doesn't have HW MENU button, because tablets with Honeycomb doesn't have MENU.

案例3 如果你的API层次: 14或更高版本

Case 3. if your API level : 14 or Higher

如果API级别为14或更高版本,可以使用hasPermanentMenuKey()。

If the API level is 14 or higher, you can use hasPermanentMenuKey().

希望将一些如何帮助你。

Hope it will some how help you.

这篇关于候补hasPermanentMenuKey()为Android 2.3.3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆