Android 12 Developer Preview is here! Try it out, and give us your feedback!

NestedScrollingParent

interface NestedScrollingParent
androidx.core.view.NestedScrollingParent

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 Android 5.0 Lollipop and newer.

Summary

Public methods
abstract Int

Return the current axes of nested scrolling for this NestedScrollingParent.

abstract Boolean
onNestedFling(@NonNull target: View, velocityX: Float, velocityY: Float, consumed: Boolean)

Request a fling from a nested scroll.

abstract Boolean
onNestedPreFling(@NonNull target: View, velocityX: Float, velocityY: Float)

React to a nested fling before the target view consumes it.

abstract 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.

abstract Unit
onNestedScroll(@NonNull target: View, dxConsumed: Int, dyConsumed: Int, dxUnconsumed: Int, dyUnconsumed: Int)

React to a nested scroll in progress.

abstract Unit
onNestedScrollAccepted(@NonNull child: View, @NonNull target: View, axes: Int)

React to the successful claiming of a nested scroll operation.

abstract Boolean
onStartNestedScroll(@NonNull child: View, @NonNull target: View, axes: Int)

React to a descendant view initiating a nestable scroll operation, claiming the nested scroll operation if appropriate.

abstract Unit
onStopNestedScroll(@NonNull target: View)

React to a nested scroll operation ending.

Public methods

getNestedScrollAxes

abstract fun getNestedScrollAxes(): Int

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.

Return
Int Flags indicating the current axes of nested scrolling