I have a RelativeLayout that looks like this:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#65ffffff" >
<com.sonyericsson.zoom.ImageZoomView
android:id="@+id/zoomview"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</RelativeLayout>
I have a bunch of touch events set for that RelativeLayout. However, the com.sonyericsson.zoom.ImageZoomView also have its own logic to handle touch events.
When I perform any touch event in the screen, the touch listeners of the com.sonyericsson.zoom.ImageZoomView class is called first (which is what I expect). The problem is that, if I return “true” in that touch event, the touch listeners of the RelativeLayout ARE NOT CALLED. Whereas if I return “false”, they are called but then, the touch processing that the class ImageZoomView did simply don’t happen! (I guess because I returned “false” in the end, so Android simply ignores any UI updates that the touch events of the class com.sonyericsson.zoom.ImageZoomView previous made).
In short, I want to be able to process the same touch event in both my com.sonyericsson.zoom.ImageZoomView AND in my RelativeLayout.
Is there any way to do that?
I am using Android 2.2+.
Thank you in advance!
I ended up using the method onInterceptTouchEvent, like below :
I had to implement the method onTouchEvent to return “false”:
That way I was able to intercept the events BEFORE they get send to the children. So, I made de processing I wanted before that.