Onclicklistener acts weird after scrolling in ScrollView
I have many ImageViews set with OnClickListeners. They extend beyond the screen, contained in a ScrollView. When scrolling down and clicking an ImageView that was previously beyond the screen, onClick(View view) does not seem to execute until the second click. It behaves normally otherwise.
My Activity implements OnClickListener and uses overridden onClick(View view).
What is happening? Is this an issue involving touch mode?
Thanks!
UPDATE: The problem I'm experiencing is similar to this bug report: http://code.google.com/p/android/issues/detail?id=11357. Works as开发者_如何学Go intended in Eclair, not Froyo.
The first click is probably setting focus to your imageview, and the second is actually clicking it. This is probably occuring because when scrolling, the scrollview takes the focus. I'm not sure, but you might try setting focusable(false)
on the scrollview. I'm not sure if that will mess with the scrolling though.
精彩评论