onInterceptTouchEvent

open fun onInterceptTouchEvent(@NonNull parent: @NonNull CoordinatorLayout, @NonNull child: @NonNull V, @NonNull ev: @NonNull MotionEvent): Boolean(source)

Respond to CoordinatorLayout touch events before they are dispatched to child views.

Behaviors can use this to monitor inbound touch events until one decides to intercept the rest of the event stream to take an action on its associated child view. This method will return false until it detects the proper intercept conditions, then return true once those conditions have occurred.

Once a Behavior intercepts touch events, the rest of the event stream will be sent to the onTouchEvent method.

This method will be called regardless of the visibility of the associated child of the behavior. If you only wish to handle touch events when the child is visible, you should add a check to isShown on the given child.

The default implementation of this method always returns false.

Return

true if this Behavior would like to intercept and take over the event stream. The default always returns false.

Parameters

parent

the parent view currently receiving this touch event

child

the child view associated with this Behavior

ev

the MotionEvent describing the touch event being processed