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 键返回到下一个文本
基础教程推荐
- 可可/目标C(OSX不是iOS)从子对象访问父对象 2022-01-01
- 突出显示朗读文本(在 iPhone 的故事书类型应用程序中) 2022-01-01
- 在 iOS8 中无法获得正确的键盘高度值 2022-01-01
- 新的@SystemApi 注解是什么意思,和@hide 有什么区别 2022-01-01
- - (CGRect)convertRect:(CGRect)rect toView:(UIView *)view 如何工作 2022-01-01
- 我的 UIImageView 的任务 2022-01-01
- Android:STATE_SELECTED不工作 2022-01-01
- 在 Android 模拟器中激活网络位置提供程序? 2022-01-01
- 如何将多个组件添加到 PickerView? 2022-01-01
- 在 appComponent dagger 2 中动态添加测试模块? 2022-01-01
