Android 禁止点击输入法的回车键并弹出提示
2019-07-25 本文已影响0人
Cedric_h
原文:https://blog.csdn.net/uyy203/article/details/54445267
//点击回车事件
mDescriContent.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if(event.getKeyCode()==KeyEvent.KEYCODE_ENTER){
Toast.makeText(getContext(), "不可以换行哦", Toast.LENGTH_SHORT).show();
return true;
}else{
return false;
}
}
});