interface NestedScrollingParent3 : NestedScrollingParent2
This interface should be implemented by ViewGroup
subclasses that wish to support scrolling operations delegated by a nested child view.
Classes implementing this interface should create a final instance of a NestedScrollingParentHelper
as a field and delegate any View or ViewGroup methods to the NestedScrollingParentHelper
methods of the same signature.
Views invoking nested scrolling functionality should always do so from the relevant ViewCompat
, ViewGroupCompat
or ViewParentCompat
compatibility shim static methods. This ensures interoperability with nested scrolling views on all versions of Android.
Summary
Public methods |
abstract Unit |
React to a nested scroll in progress.
|
Inherited functions |
From class NestedScrollingParent
Int |
getNestedScrollAxes()
Return the current axes of nested scrolling for this NestedScrollingParent.
A NestedScrollingParent returning something other than ViewCompat#SCROLL_AXIS_NONE is currently acting as a nested scrolling parent for one or more descendant views in the hierarchy.
|
Boolean |
onNestedFling(@NonNull target: View, velocityX: Float, velocityY: Float, consumed: Boolean)
Request a fling from a nested scroll.
This method signifies that a nested scrolling child has detected suitable conditions for a fling. Generally this means that a touch scroll has ended with a velocity in the direction of scrolling that meets or exceeds the minimum fling velocity along a scrollable axis.
If a nested scrolling child view would normally fling but it is at the edge of its own content, it can use this method to delegate the fling to its nested scrolling parent instead. The parent may optionally consume the fling or observe a child fling.
|
Boolean |
onNestedPreFling(@NonNull target: View, velocityX: Float, velocityY: Float)
React to a nested fling before the target view consumes it.
This method siginfies that a nested scrolling child has detected a fling with the given velocity along each axis. Generally this means that a touch scroll has ended with a velocity in the direction of scrolling that meets or exceeds the minimum fling velocity along a scrollable axis.
If a nested scrolling parent is consuming motion as part of a pre-scroll , it may be appropriate for it to also consume the pre-fling to complete that same motion. By returning true from this method, the parent indicates that the child should not fling its own internal content as well.
|
Unit |
onNestedPreScroll(@NonNull target: View, dx: Int, dy: Int, @NonNull consumed: IntArray)
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.
|
Unit |
onNestedScroll(@NonNull target: View, dxConsumed: Int, dyConsumed: Int, dxUnconsumed: Int, dyUnconsumed: Int)
React to a nested scroll in progress.
This method will be called when the ViewParent's current nested scrolling child view dispatches a nested scroll event. To receive calls to this method the ViewParent must have previously returned true for a call to onStartNestedScroll(View, View, int) .
Both the consumed and unconsumed portions of the scroll distance are reported to the ViewParent. An implementation may choose to use the consumed portion to match or chase scroll position of multiple child elements, for example. The unconsumed portion may be used to allow continuous dragging of multiple scrolling or draggable elements, such as scrolling a list within a vertical drawer where the drawer begins dragging once the edge of inner scrolling content is reached.
|
Unit |
onNestedScrollAccepted(@NonNull child: View, @NonNull target: | |