Android Physical/Capacitive 导航按钮

Android Physical/Capacitive Navigation Buttons

如何检查设备上的屏幕或 Physical/Capacitive 导航按钮

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

仅适用于 API 级别 14+

更多信息here and here

有帮助的最佳答案是 this

boolean hasMenuKey = ViewConfiguration.get(context).hasPermanentMenuKey();
boolean hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK);

if(!hasMenuKey && !hasBackKey) {

}