監聽上下左右鍵

 public boolean onKeyDown(int keyCode, KeyEvent event) {         switch (keyCode) {         case KeyEvent.KEYCODE_DPAD_CENTER:             display("中鍵報道,被按下");             break;         case KeyEvent.KEYCODE_DPAD_DOWN:             display("下鍵報道,被按下");             break;         case KeyEvent.KEYCODE_DPAD_LEFT:             display("左鍵報道,被按下");             break;         case KeyEvent.KEYCODE_DPAD_RIGHT:             display("右鍵報道,被按下");             break;         case KeyEvent.KEYCODE_DPAD_UP:             display("上鍵報道,被按下");             break;         }         return super.onKeyDown(keyCode, event);     }
相關文章
相關標籤/搜索