我想知道是否有一种方法来处理用户pressing 输入打字时的的EditText
,有点像的onsubmit HTML事件。
另外不知道是否有一种方法可以在这样一种方式,完成按钮被其他标记的东西(例如,去),进行点击时(再次,像的onSubmit)某个动作操纵虚拟键盘。
解决方案我想知道是否有一种方法来 处理用户pressing 输入而 键入一个EditText,像 使用onSubmit HTML事件。
是的。
也想知道是否有办法 操纵虚拟键盘在 这样的方式的完成按钮是 标有别的东西(例如 去),并进行了一定作用 点击时(同样,像的onsubmit)。
还不错。
您会想看看android:imeActionId和android:imeOptions属性,加setOnEditorActionListener()法,都在的TextView
。
有关改变的完成按钮上的文本到自定义字符串,可以使用:
mEditText.setImeActionLabel(自定义文本,KeyEvent.KEY code_ENTER);
![u盘连接电脑后自动备份文件夹操作教程](https://p.xsw88.cn/allimgs/daicuo/20230911/3998.png)
I am wondering if there is a way to handle the user pressing Enter while typing in an EditText
, something like the onSubmit HTML event.
Also wondering if there is a way to manipulate the virtual keyboard in such a way that the "Done" button is labeled something else (for example "Go") and performs a certain action when clicked (again, like onSubmit).
解决方案I am wondering if there is a way to handle the user pressing Enter while typing in an EditText, something like the onSubmit HTML event.
Yes.
Also wondering if there is a way to manipulate the virtual keyboard in such a way that the "Done" button is labeled something else (for example "Go") and performs a certain action when clicked (again, like onSubmit).
Also yes.
You will want to look at the android:imeActionId
and android:imeOptions
attributes, plus the setOnEditorActionListener()
method, all on TextView
.
For changing the text of the "Done" button to a custom string, use:
mEditText.setImeActionLabel("Custom text", KeyEvent.KEYCODE_ENTER);
相关推荐
最新文章