Android版的EditText返回键进入下一个文本 [英] Android edittext key return goes to next text
问题描述
我有一系列的EditText项,当用户点击回车键就会进入下一个Editext会喜欢它。我知道如何做到这一次,但有没有办法来告诉所有的EditText控件的使用,检查的主要入口,并移动鼠标相同的功能。似乎有种疯狂有一个功能为每个EditTexts的
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:单线=真正的
和的android:imeOptions =actionNext
(至少为单行条目,textviews)。更多在Android <一个href=\"http://developer.android.com/reference/android/widget/TextView.html#attr_android:imeOptions\">documentation为TextView的。
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
是的德$ p $现在pcated 的,但你可以离开它。它是可编辑文本的默认行为,只要你不明确设置的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返回键进入下一个文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!