美文网首页
输入框edittext,改变键盘enter文字

输入框edittext,改变键盘enter文字

作者: 吼吼吼dd | 来源:发表于2017-10-09 17:43 被阅读0次

actionUnspecified  未指定,对应常量EditorInfo.IME_ACTION_UNSPECIFIED.

actionNone 没有动作,对应常量EditorInfo.IME_ACTION_NONE

actionGo 去往,对应常量EditorInfo.IME_ACTION_GO

actionSearch 搜索,对应常量EditorInfo.IME_ACTION_SEARCH

actionSend 发送,对应常量EditorInfo.IME_ACTION_SEND

actionNext 下一个,对应常量EditorInfo.IME_ACTION_NEXT

actionDone 完成,对应常量EditorInfo.IME_ACTION_DONE

配合singline=true;可以实现enter箭头改为对应文字。

监听方法:

Edit.setOnEditorActionListener(newTextView.OnEditorActionListener() {

@OverridepublicbooleanonEditorAction(TextView v,intactionId, KeyEventevent){if(actionId == EditorInfo.IME_ACTION_SEARCH  (搜索)||(event!=null&&event.getKeyCode()== KeyEvent.KEYCODE_ENTER)){if(TextUtils.isEmpty(mSearchEdit.getText())){

mSearchEdit.requestFocus();

mSearchEdit.setError("不能为空");

}else{//do reseach}returntrue;

}returnfalse;

}

});

相关文章

网友评论

      本文标题:输入框edittext,改变键盘enter文字

      本文链接:https://www.haomeiwen.com/subject/fhwijxtx.html