Skip to content Skip to sidebar Skip to footer

Gestureoverlayview Is Blocking Touch Events

I wish to create a custom view for my gestures, I wish to draw them by my self. But I do not getting touch events, or I am getting them and the GestureOverlayView not. Can you help

Solution 1:

You can ovveride the onTouchEvent method like this

@OverridepublicbooleanonTouchEvent(MotionEvent event) {
// Your code here
}

Solution 2:

I think you might be doing a silly mistake i was doing previously. dont take gestureOverlayView parallely to views you want touchables, but take those views as child of gestureOverLayView.

what you should not do

<RelativeLayoutandroid:layout_width="match_parent"android:layout_height="match_parent" ><android.gesture.GestureOverlayViewandroid:id="@+id/gOverlay"android:layout_width="match_parent"android:layout_height="match_parent"android:eventsInterceptionEnabled="true"android:fadeOffset="1000"android:gestureColor="@color/gesture_color"android:gestureStrokeType="multiple"android:uncertainGestureColor="@color/gesture_color" ></android.gesture.GestureOverlayView><LinearLayoutandroid:id="@+id/customtab"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="horizontal"android:weightSum="3" ></LinearLayout></RelativeLayout>

What you should do..

<android.gesture.GestureOverlayViewandroid:id="@+id/gOverlay"android:layout_width="match_parent"android:layout_height="match_parent"android:eventsInterceptionEnabled="true"android:fadeOffset="1000"android:gestureColor="@color/gesture_color"android:gestureStrokeType="multiple"android:uncertainGestureColor="@color/gesture_color" ><LinearLayoutandroid:id="@+id/customtab"android:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:weightSum="3" ></LinearLayout></android.gesture.GestureOverlayView>

Post a Comment for "Gestureoverlayview Is Blocking Touch Events"