Udostępnij za pośrednictwem


IViewParent.OnNestedPreScroll(View, Int32, Int32, Int32[]) Method

Definition

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

[Android.Runtime.Register("onNestedPreScroll", "(Landroid/view/View;II[I)V", "GetOnNestedPreScroll_Landroid_view_View_IIarrayIHandler:Android.Views.IViewParentInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public void OnNestedPreScroll (Android.Views.View target, int dx, int dy, int[] consumed);
[<Android.Runtime.Register("onNestedPreScroll", "(Landroid/view/View;II[I)V", "GetOnNestedPreScroll_Landroid_view_View_IIarrayIHandler:Android.Views.IViewParentInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member OnNestedPreScroll : Android.Views.View * int * int * int[] -> unit

Parameters

target
View

View that initiated the nested scroll

dx
Int32

Horizontal scroll distance in pixels

dy
Int32

Vertical scroll distance in pixels

consumed
Int32[]

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

Attributes

Remarks

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 View#dispatchNestedPreScroll(int, int, int[], int[]). 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.

Java documentation for android.view.ViewParent.onNestedPreScroll(android.view.View, int, int, int[]).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to