我有這樣的代碼,它監聽ENTER和MULTIPLY,並在按下時調用一個方法。問題是它只在按下輸入時調用它,它不適用於乘法?我究竟做錯了什麼 ?dispatch dispatchKeyEvent?
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
if (event.getKeyCode() == KeyEvent.KEYCODE_ENTER) {
if (event.getAction() == KeyEvent.ACTION_UP) {
enter();
return true;
}
}
if (event.getKeyCode() == KeyEvent.KEYCODE_NUMPAD_MULTIPLY) {
if (event.getAction() == KeyEvent.ACTION_UP) {
enter();
return true;
}
}
return super.dispatchKeyEvent(event);
};
編輯:試着與KEYCODE_STAR
仍然無法正常工作..它被竊聽?
有人嗎?請 –