Android屏蔽后退键的方法
1 public boolean onKeyDown(int keyCode, KeyEvent event) { 2 if (event.getAction() == KeyEvent.ACTION_DOWN 3 && event.getKeyCode() == KeyEvent.KEYCODE_BACK) { 4 return true;//消费掉后退键 5 6 } 7 return super.onKeyDown(keyCode, event); 8 }
1 public boolean onKeyDown(int keyCode, KeyEvent event) { 2 if (event.getAction() == KeyEvent.ACTION_DOWN 3 && event.getKeyCode() == KeyEvent.KEYCODE_BACK) { 4 return true;//消费掉后退键 5 6 } 7 return super.onKeyDown(keyCode, event); 8 }