【问题标题】:Android Physical/Capacitive Navigation ButtonsAndroid 物理/电容式导航按钮
【发布时间】:2016-04-28 19:25:15
【问题描述】:

如何检查设备上的屏幕或物理/电容式导航按钮

【问题讨论】:

    标签: java android button navigation


    【解决方案1】:

    你可以使用ViewConfiguration.get(context).hasPermanentMenuKey()

    仅适用于 API 级别 14+

    更多信息here和here

    最好的答案是this

    boolean hasMenuKey = ViewConfiguration.get(context).hasPermanentMenuKey();
    boolean hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK);
    
    if(!hasMenuKey && !hasBackKey) {
    
    }
    

    【讨论】:

    • HI @saur 上述解决方案在 Nexus 和三星设备中运行良好,但在 Moto x play 中也无法运行 Micro max 设备,所以有什么通用解决方案吗?
    • @Arpan24x7 我已经在 moto e(1st gen)(L) 和 moto g(3rd gen)(M) 中测试了软键盘和 redmi 1s(J) 的代码,redmi prime(K) 为以及用于硬键盘的 micromax a106(L),对我来说工作正常……它是 moto x play 特有的吗?它是哪种 micromax 设备?
    • 在这里我发现了我拥有的两个设备中的错误,1) Moto X play 2) Micromax Canvas Express 2
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-24
    • 2018-12-05
    • 1970-01-01
    相关资源
    最近更新 更多