Android:EditText.settext() 的问题
我有一个取景器。它的视图之一有 3 个按钮(a、b、c)和 3 个 EditText。每当单击按钮时,第一个 Textedit 应显示单击按钮的文本,并且光标应跳转到下一个 EitText。单击第三个按钮后,第三个 EditText(最后一个)应显示文本,然后应运行 viewflipper.showNext()。
问题:单击第三个按钮后,如果我将 showNext() 放在 EditText.setText() 之后,则 EditText 不会显示文本,但如果 EditText.setText() 之后没有 showNext(),则会显示文本。我认为 showNext() 在文本出现在 editText 之前运行。我怎样才能防止这种情况发生?
请帮忙!
I have a viewflipper. One of its views has 3 Buttons (a, b, c) and 3 EditTexts. Whenever a Button is clicked, the first Textedit should show the text of the clicked Button and the cursor should jump to the next EitText. After clicking the third Button, the third EditText (the last one) should show the text and then viewflipper.showNext() should be run.
The Problem: After clicking the third Button, if I put showNext() after EditText.setText() the EditText doesn't show the text but If there is no showNext() after EditText.setText() it shows the text. I think showNext() runs before the text appears on editText. How can I prevent that?
please help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
所以听起来您想延迟 viewFlipper.ShowNext() 的运行,直到 EditField3.setText() 发生后。
我会使用处理程序运行延迟 0.5 秒左右的代码块(确保在设备上测试,而不仅仅是模拟器)......
So it sounds like you want to delay the running of the viewFlipper.ShowNext() until the after EditField3.setText() happens.
I would use a Handler run the code block delayed by 0.5 seconds or so (be sure to test on a device and not just the emulator).....