Partager via


View.StartNestedScroll(ScrollAxis) Method

Definition

Begin a nestable scroll operation along the given axes.

[Android.Runtime.Register("startNestedScroll", "(I)Z", "GetStartNestedScroll_IHandler")]
public virtual bool StartNestedScroll (Android.Views.ScrollAxis axes);
[<Android.Runtime.Register("startNestedScroll", "(I)Z", "GetStartNestedScroll_IHandler")>]
abstract member StartNestedScroll : Android.Views.ScrollAxis -> bool
override this.StartNestedScroll : Android.Views.ScrollAxis -> bool

Parameters

axes
ScrollAxis

Flags consisting of a combination of #SCROLL_AXIS_HORIZONTAL and/or #SCROLL_AXIS_VERTICAL.

Returns

true if a cooperative parent was found and nested scrolling has been enabled for the current gesture.

Attributes

Remarks

Begin a nestable scroll operation along the given axes.

A view starting a nested scroll promises to abide by the following contract:

The view will call startNestedScroll upon initiating a scroll operation. In the case of a touch scroll this corresponds to the initial MotionEvent#ACTION_DOWN. In the case of touch scrolling the nested scroll will be terminated automatically in the same manner as ViewParent#requestDisallowInterceptTouchEvent(boolean). In the event of programmatic scrolling the caller must explicitly call #stopNestedScroll() to indicate the end of the nested scroll.

If startNestedScroll returns true, a cooperative parent was found. If it returns false the caller may ignore the rest of this contract until the next scroll. Calling startNestedScroll while a nested scroll is already in progress will return true.

At each incremental step of the scroll the caller should invoke #dispatchNestedPreScroll(int, int, int[], int[]) dispatchNestedPreScroll once it has calculated the requested scrolling delta. If it returns true the nested scrolling parent at least partially consumed the scroll and the caller should adjust the amount it scrolls by.

After applying the remainder of the scroll delta the caller should invoke #dispatchNestedScroll(int, int, int, int, int[]) dispatchNestedScroll, passing both the delta consumed and the delta unconsumed. A nested scrolling parent may treat these values differently. See ViewParent#onNestedScroll(View, int, int, int, int).

Java documentation for android.view.View.startNestedScroll(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

See also

  • StopNestedScroll()
  • <xref:Android.Views.View.DispatchNestedPreScroll(System.Int32%2c+System.Int32%2c+System.Int32%2c+System.Int32)>
  • <xref:Android.Views.View.DispatchNestedScroll(System.Int32%2c+System.Int32%2c+System.Int32%2c+System.Int32%2c+System.Int32)>