0

I have this situation where my textfield is embedded within a TableViewRow like this http://cl.ly/1i372j0Q062H010L2O0y

I wanted a situation when someone click on the "Password" row, I will focus on the Password Textfield and when someone click on anywhere else in the window, the password will get blur().

However, the problem comes in when both Window.click and PasswordRow.click got fired when the user clicks on the PasswordRow. This make the textfield.focus() and textfield.blur() got executed, resulting is no focus at all.

Anyway I can workaround it? Or is there a better way to blur it than to listen to Window.click?

Cheers, Mickey

4

1 回答 1

0

我以前多次遇到过这个问题。有一个奇怪的错误,在 tableview 上触发的事件将在窗口上触发。我有一个问题,我将文本框设置为数字键盘,我必须在文本框上单击两次才能显示它,然后它就不是数字键盘了。

论坛上有很多解决方案,例如捕获窗口事件并且在某些情况下什么都不做,使用模态窗口等。我建议不要使用 tableView(如果可能的话)。如果您需要它看起来像那样,您可能可以将视图设置为看起来相同。

如果你想走另一条路,这里有一个帖子,其中一条评论提到过滤掉其他事件:

http://developer.appcelerator.com/question/117540/textfield-on-tableview-loses-focus-android

于 2012-06-06T08:48:38.673 回答