如何使用KeyEvent.KEYCODE_ENTER
均衡android按钮,即当我按ENTER
到物理键盘时,点击我的按钮?
Button enterBtn;
saveBtn = (Button) findviewbyId(R.id.enter);
答案 0 :(得分:0)
editText.setOnKeyListener(new OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
switch(keyCode) {
case KeyEvent.KEYCODE_ENTER:
// put your button click code here
break;
default:
return false;
}
return true;
}
});