@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
//按下返回键
event.getKeyCode() = KeyEvent.KEYCODE_BACK;
//按下菜单键
event.getKeyCode() = KeyEvent.KEYCODE_MENU;
//按下HOME键
event.getKeyCode() = KeyEvent.KEYCODE_HOME;
//按下音量键
event.getKeyCode() = KeyEvent.KEYCODE_VOLUME_UP;
= KeyEvent.KEYCODE_VOLUME_DOWN;
//按下电源键
event.getKeyCode() = KeyEvent.KEYCODE_POWER;
//没有重复
event.getRepeatCount() = 0;
//默认返回true
return super.onKeyDown(keyCode, event);
}
物理按键及onKeyDown( )方法
最新推荐文章于 2024-03-28 10:20:26 发布