onNestedPreScroll

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

React to a nested scroll in progress before the target view consumes a portion of the scroll.

When working with nested scrolling often the parent view may want an opportunity to consume the scroll before the nested scrolling child does. An example of this is a drawer that contains a scrollable list. The user will want to be able to scroll the list fully into view before the list itself begins scrolling.

onNestedPreScroll is called when a nested scrolling child invokes dispatchNestedPreScroll. The implementation should report how any pixels of the scroll reported by dx, dy were consumed in the consumed array. Index 0 corresponds to dx and index 1 corresponds to dy. This parameter will never be null. Initial values for consumed[0] and consumed[1] will always be 0.

Parameters

target

View that initiated the nested scroll

dx

Horizontal scroll distance in pixels

dy

Vertical scroll distance in pixels

consumed

Output. The horizontal and vertical scroll distance consumed by this parent

type

the type of input which cause this scroll event


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