onNestedPreScroll

open fun onNestedPreScroll(@NonNull coordinatorLayout: @NonNull CoordinatorLayout, @NonNull child: @NonNull V, @NonNull target: @NonNull View, dx: Int, dy: Int, consumed: @NonNull Array<Int>, type: Int)(source)

Called when a nested scroll in progress is about to update, before the target has consumed any of the scrolled distance.

Any Behavior associated with the direct child of the CoordinatorLayout may elect to accept the nested scroll as part of onStartNestedScroll. Each Behavior that returned true will receive subsequent nested scroll events for that nested scroll.

onNestedPreScroll is called each time the nested scroll is updated by the nested scrolling child, before the nested scrolling child has consumed the scroll distance itself. Each Behavior responding to the nested scroll will receive the same values. The CoordinatorLayout will report as consumed the maximum number of pixels in either direction that any Behavior responding to the nested scroll reported as consumed.

Parameters

coordinatorLayout

the CoordinatorLayout parent of the view this Behavior is associated with

child

the child view of the CoordinatorLayout this Behavior is associated with

target

the descendant view of the CoordinatorLayout performing the nested scroll

dx

the raw horizontal number of pixels that the user attempted to scroll

dy

the raw vertical number of pixels that the user attempted to scroll

consumed

out parameter. consumed[0] should be set to the distance of dx that was consumed, consumed[1] should be set to the distance of dy that was consumed

type

the type of input which cause this scroll event

See also


open fun onNestedPreScroll(@NonNull coordinatorLayout: @NonNull CoordinatorLayout, @NonNull child: @NonNull V, @NonNull target: @NonNull View, dx: Int, dy: Int, consumed: @NonNull Array<Int>)(source)

Deprecated

You should now override onNestedPreScroll. This method will still continue to be called if the type is TYPE_TOUCH.