views:

493

answers:

1

I have a custom layout that I have written that basically just displays a bunch of ImageViews. I am handing onTouch events for all the ImageViews in my layout. However, if a user touches one imageView and then drags over another ImageView, I would like to be able to handle that as well.

How would I go about capturing this behavior?

A: 

maybe this example is useful: http://www.anddev.org/viewtopic.php?p=11603

it relies on tracking the event with MotionEvent.ACTION_MOVE. the coordinates could be checked to determine when the element enters/exits a cell.

it uses drawview, but hopefully the same can be done w/imageview

jspcal
Yeah, that is probably one way, though it seems like its not all that efficient to loop through all of my views and look for a hit.What I would prefer is to handle touch at the Layout level, and if there is an imageView at that touch location, dispatch a touch event to that imageView.
k_day
I tried handling the motion event at the imageView level, and giving up focus if I determine that the finger is no longer over the imageView. However, once I clear focus, and the finger (still pressed) goes over another imageView, that imageView will not receive focus. Is there any way for me to get this behavior?I appreciate any help.
k_day