次の方法で共有


View.DispatchNestedPreFling(Single, Single) Method

Definition

Dispatch a fling to a nested scrolling parent before it is processed by this view.

[Android.Runtime.Register("dispatchNestedPreFling", "(FF)Z", "GetDispatchNestedPreFling_FFHandler")]
public virtual bool DispatchNestedPreFling (float velocityX, float velocityY);
[<Android.Runtime.Register("dispatchNestedPreFling", "(FF)Z", "GetDispatchNestedPreFling_FFHandler")>]
abstract member DispatchNestedPreFling : single * single -> bool
override this.DispatchNestedPreFling : single * single -> bool

Parameters

velocityX
Single

Horizontal fling velocity in pixels per second

velocityY
Single

Vertical fling velocity in pixels per second

Returns

true if a nested scrolling parent consumed the fling

Attributes

Remarks

Dispatch a fling to a nested scrolling parent before it is processed by this view.

Nested pre-fling events are to nested fling events what touch intercept is to touch and what nested pre-scroll is to nested scroll. dispatchNestedPreFling offsets an opportunity for the parent view in a nested fling to fully consume the fling before the child view consumes it. If this method returns true, a nested parent view consumed the fling and this view should not scroll as a result.

For a better user experience, only one view in a nested scrolling chain should consume the fling at a time. If a parent view consumed the fling this method will return false. Custom view implementations should account for this in two ways:

<ul> <li>If a custom view is paged and needs to settle to a fixed page-point, do not call dispatchNestedPreFling; consume the fling and settle to a valid position regardless.</li> <li>If a nested parent does consume the fling, this view should not scroll at all, even to settle back to a valid idle position.</li> </ul>

Views should also not offer fling velocities to nested parent views along an axis where scrolling is not currently supported; a android.widget.ScrollView ScrollView should not offer a horizontal fling velocity to its parents since scrolling along that axis is not permitted and carrying velocity along that motion does not make sense.

Java documentation for android.view.View.dispatchNestedPreFling(float, float).

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