Not Gabriel
Not Gabriel

Reputation: 561

After intercepting a touch event, how to give it back to a child?

I have a custom FrameLayout which overrides this method:

@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
    switch (ev.getAction()) {
        case MotionEvent.ACTION_MOVE:
            return interceptTouchEvents;
    }

    return false;
}

I then have a touch listener which I set as the TouchListener of this FrameLayout. At some point inside the onTouch method I'd like to forward this event to a children.

Upvotes: 1

Views: 497

Answers (1)

Silvans Solanki
Silvans Solanki

Reputation: 1267

you can use below code for dispatch touch event to view, // Dispatch touch event to view

view.dispatchTouchEvent(motionEvent);

Hope this will help.

Thanks

Upvotes: 4

Related Questions