Android edittext key return goes to next text(Android edittext 键返回到下一个文本)
问题描述
我有一系列 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 键返回到下一个文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Android edittext 键返回到下一个文本


- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01
- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01
- Android - 拆分 Drawable 2022-01-01
- Android viewpager检测滑动超出范围 2022-01-01
- 用 Swift 实现 UITextFieldDelegate 2022-01-01
- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01
- android 4中的android RadioButton问题 2022-01-01