Android:以编程方式检测设备是否具有硬件菜单按钮 [英] Android: Programmatically detect if device has hardware menu button

查看:15
本文介绍了Android:以编程方式检测设备是否具有硬件菜单按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在努力解决这个问题.我需要检查安装应用程序的设备是否有硬件菜单键.因为它在 Galaxy Nexus 等某些设备上不存在,所以在这种情况下,我直接在 UI 中显示它.

I'm currently struggling with this issue. I need to check if the device, where the app is installed, has a hardware menu key. Because it is not existing on some devices like Galaxy Nexus, I'm showing it directly in the UI in this case.

我已经看过 PackageManager.hasSystemFeature(),但没有发现任何有用的东西.

I have already looked at PackageManager.hasSystemFeature(), but didn't find anything useful there.

有人已经这样做了吗?

推荐答案

ViewConfiguration.get(context).hasPermanentMenuKey()

参见 ViewConfiguration#hasPermanentMenuKey() 了解更多信息.请注意,这仅适用于 API 级别 14+(Android 4.0 Ice Cream Sandwich 或更高版本).

See ViewConfiguration#hasPermanentMenuKey() for more information. Note that this is only available for API level 14+ (Android 4.0 Ice Cream Sandwich or newer).

这篇关于Android:以编程方式检测设备是否具有硬件菜单按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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