setOnEditorActionListener方法可以监听到EditView中的回车按钮,解决界面onkey无效
et_result.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (KeyEvent.KEYCODE_ENTER ==event.getKeyCode()&&event.getRepeatCount()==0) {
//这边写业务逻辑
}
return (event.getKeyCode() == KeyEvent.KEYCODE_ENTER);
}
}
);