onTouchEvent

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

Respond to CoordinatorLayout touch events after this Behavior has started intercepting them.

Behaviors may intercept touch events in order to help the CoordinatorLayout manipulate its child views. For example, a Behavior may allow a user to drag a UI pane open or closed. This method should perform actual mutations of view layout state.

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.

Return

true if this Behavior handled this touch event and would like to continue receiving events in this 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