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 键返回到下一个文本
基础教程推荐
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- iOS4 创建后台定时器 2022-01-01
