如何使用 Android 横向键盘按钮?
我有一个有两个 EditText 的活动。如果在横向模式下,我选择第一个 EditText,则显示的键盘上有一个“下一步”按钮,可以让我输入第二个 EditText。同样,第二个 EditText 有一个“完成”按钮,我想处理该按钮以完成活动。我该如何处理这些按钮的选择?
I have an activity with two EditTexts. If, in landscape mode, I select the first EditText, the keyboard that is displayed has a "next" button which should allow me to type in the second EditText. Likewise, the second EditText has a "done" button, which I would like to handle for completing the activity. How can I handle the selection of these buttons?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
关于如何解决此问题的文档相当少。我在此处找到了一个很好的解决方案。基本上,您可以为每个 EditText 添加 IME 选项:
对于第一个:
对于第二个:
要在代码中处理这些,请尝试如下操作:
There is fairly little documentation on how to solve this issue. I found a good solution here. Basically, you can add an IMEoption for each of the EditTexts:
For the first one:
For the second one:
To handle these in the code, try something like this: