我有一系列 EditText 条目并且想要它,因此当用户按下回车键时,它将转到下一个 EditText.我知道如何一次执行此操作,但是有没有办法告诉所有的 edittext 控件使用检查键输入和前进光标的相同功能.为每个 EditText 设置一个函数似乎有点疯狂
I have a series of EditText entries and would like it so when the user hits the enter key it will go to the next Editext. I know how do this one at a time but is there a way to tell all of the edittext controls to use the same function that checks the key entry and advances the cursor. It seems kind of crazy to have one function for each of the EditTexts
比嗅探键简单得多:尝试设置 android:singleLine="true"
和 android:imeOptions="actionNext"
(至少对于单行输入文本视图).阅读有关 TextView 的 Android 文档 中的更多信息.
Much simpler than sniffing keys: try setting android:singleLine="true"
and android:imeOptions="actionNext"
(at least for single-line entry textviews). Read more in the Android documentation for TextView.
更新: singleLine
已弃用 现在,但您可以忽略它.这是可编辑文本的默认行为,只要您没有明确设置 android:inputType="textMultiLine"
,并且 inputType
会覆盖建议的 singleLine
无论如何替换 maxLines="1"
为可编辑文本.
Update: singleLine
is deprecated now, but you can leave it out. It's the default behavior for editable text as long as you don't explicitly set android:inputType="textMultiLine"
, and inputType
overrides the suggested singleLine
replacement of maxLines="1"
for editable text anyways.
这篇关于Android edittext 键返回到下一个文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!