// mNumberEt.setOnEditorActionListener(new OnEditorActionListener() {
//
// public boolean onEditorAction(TextView v, int actionId,
// KeyEvent event) {
// if (actionId == EditorInfo.IME_ACTION_DONE
// || actionId == EditorInfo.IME_MASK_ACTION) {
//
// return false;
// }
// return false;
// }
// });
推薦使用第二種方法
mNumberEt.setOnKeyListener(new OnKeyListener() {
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_ENTER) {//Enter鍵
return false;
}
return false;
}
});