views:

32

answers:

1

Hi everyone:

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 intended in Eclair, not Froyo.

+1  A: 

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.

Falmarri
Good point on focusability. Unfortunately, both setFocusable(false) and setFocusableInTouchMode(false) didn't improve the problem.
Jeffrey
Is your scrollview implementing any ontouch methods?
Falmarri
I'm using a GestureDetector and View.OnTouchListener to capture onFling() motion. A ViewFlipper is utilized to switch between ScrollViews. The odd behavior exists with and without it. Thanks for the follow-up!
Jeffrey