android - 如何确定屏幕上的软按钮android

标签 android uibutton

我正在开发 android 应用程序。我必须在屏幕上的特定位置设置图像。当此图像中的屏幕按钮出现时出现问题! enter image description here

我用谷歌搜索了很多,但没有找到任何帮助。有没有办法以编程方式检测屏幕按钮上的这些? 感谢您的帮助。

最佳答案

您可以使用

检查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/

相关文章:

Android 主屏幕小部件(图标、标签 - 样式)

android - 使用Where语句的Windows Azure移动服务

ios - 如何禁用 UIButton 振动

ios - 从一个类调用方法并在另一个类中使用

ios - 如果我想为 UIButton 创建更大的点击区域,我应该覆盖 hitTest : or pointInside:?

ios - 文本 UIButton 周围的边框

用于 ListView 项的 Android 工具栏上下文菜单

android - 您是否检查膨胀 View 是否为空?

android - 如何在 aidl 文件中返回 hashmap

ios - 如何在 tableView 单元格上获取点击事件 UIbutton?