自动获取对话框中 EditText 的键盘 (Android)
这个问题的近亲似乎遍布 StackExchange,但也许这就是为什么我找不到答案......
我有一个应用程序。在应用程序中,我有几个不同的表面视图,每个视图都有几个不同的操作来启动对话框。
我的对话框由一个 EditText(用于输入某些数据)以及用于对该数据进行操作的“设置”和“取消”按钮组成。要输入数据,用户首先触摸 EditText 以调出键盘,然后输入数据,触摸“完成”,然后触摸“设置”,应用程序将继续其愉快的运行方式。
如果可能的话,我想找到一种方法来缩短这个时间。具体来说,我想跳过对话框视图并直接转到键盘视图。 (本质上,我想以编程方式“触摸”EditText,如果这有意义的话。)
就像我在开头所说的那样,我没有太多运气,所以任何建议都会很高兴地得到考虑。而且,不幸的是,已经尝试过简单地在 EditText 中请求焦点,但没有成功......
R.
Close cousins of this question seem to be all over StackExchange, but maybe that's why I can't find an answer...
I have an application. Within the application, I've got a couple different Surface Views, and each of them has a couple different actions that fire up a Dialog.
My dialogs consists of an EditText (for typing in some data) and Set and Cancel buttons for acting on that data. To type in the data, the user first touches the EditText to bring up the keyboard, then types the data, touches Done, then touches Set, and the application continues on its merry way.
I would like to find a way to shorten this, if at all possible. Specifically, I would like to skip over the view of the dialog and go right to the view of the keyboard. (Essentially, I want to programmatically "touch" the EditText, if that makes any sense.)
Like I said at the beginning of this, I'm not having a lot of luck, so any suggestions will be happily looked in to. And, unfortunately, simply requesting focus in the EditText has been tried and hasn't done the trick...
R.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
试试这个
Try this
最简单且最好的方法是在打开对话框时将焦点放在 EditText 上:
The easy and best way , is to give focus to your EditText when your open the dialogues :