There is a way to intercept touch events sent to a view:

http://developer.android.com/reference/android/view/View.html#setOnTouchListener(android.view.View.OnTouchListener)

... and it should work with an ImageView and such.

I'd also consider writing your own view subclass and handling the UI
interaction completely within that view:

http://developer.android.com/reference/android/view/View.html#onTouchEvent(android.view.MotionEvent)

You could also subclass ViewGroup - or probably one of the layout classes,
such as FrameLayout, and then use this:

http://developer.android.com/reference/android/view/ViewGroup.html#onInterceptTouchEvent(android.view.MotionEvent)

... to direct events to this view or to enclosed views, if you wanted to do
it that way.

-- Kostya

25 января 2012 г. 22:08 пользователь darrinps <[email protected]> написал:

> OK, so this is a good one.
>
> I need the ability to allow an image to be re-sizable (pinch zoom for
> example) and scrollable (finger drag) yet still allow parts of that
> image to be pressed and depending on which part is pressed, have a
> different action take place.
>
> For example, suppose my image had four areas where each area (denoted
> by []) can be selected like this:
>
> [][]
> [][]
>
> If the user pinch zooms the thing it might look like this:
>
> [   ][   ]
> [   ][   ]
>
> I thought about breaking the image up into areas and using image view
> buttons but I am not so sure about scrolling the thing or zooming.
>
> So, is there any way to specify coordinates on an image and based on
> where the user presses know what area they touched? Of course this
> would need to be tracked and adjusted as they pan/zoom the thing.
>
> Thanks!
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to