我正在开发 android 应用程序。我必须在屏幕上的特定位置设置图像。当此图像中的屏幕按钮出现时出现问题!
我用谷歌搜索了很多,但没有找到任何帮助。有没有办法以编程方式检测屏幕按钮上的这些? 感谢您的帮助。
最佳答案
您可以使用
检查hasPermanentMenuKey
boolean hasMenuKey = ViewConfiguration.get(context).hasPermanentMenuKey();
如果返回真,则表示您没有软键。
关于不同的 API 级别,不要担心 honeycomb
,因为它们没有软键,有关不同 API 的更多信息请阅读 please refer to this answer .
Report if the device has a permanent menu key available to the user.
As of Android 3.0, devices may not have a permanent menu key available. Apps should use the action bar to present menu options to users. However, there are some apps where the action bar is inappropriate or undesirable. This method may be used to detect if a menu key is present. If not, applications should provide another on-screen affordance to access functionality.
关于android - 如何确定屏幕上的软按钮android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15038155/