NestedScrollingChild3

Added in 1.1.0

interface NestedScrollingChild3 : NestedScrollingChild2

Known direct subclasses
NestedScrollView

NestedScrollView is just like ScrollView, but it supports acting as both a nested scrolling parent and child on both new and old versions of Android.

RecyclerView

A flexible view for providing a limited window into a large data set.

SwipeRefreshLayout

The SwipeRefreshLayout should be used whenever the user can refresh the contents of a view via a vertical swipe gesture.

Known indirect subclasses
BaseGridView

An abstract base class for vertically and horizontally scrolling lists.

HorizontalGridView

A android.view.ViewGroup that shows items in a horizontal scrolling list.

VerticalGridView

A android.view.ViewGroup that shows items in a vertically scrolling list.

WearableRecyclerView

Wearable specific implementation of the RecyclerView enabling setCircularScrollingGestureEnabled circular scrolling} and semi-circular layouts.


This interface should be implemented by View subclasses that wish to support dispatching nested scrolling operations to a cooperating parent ViewGroup.

Classes implementing this interface should create a final instance of a NestedScrollingChildHelper as a field and delegate any View methods to the NestedScrollingChildHelper 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 functions

Unit
dispatchNestedScroll(
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int,
    offsetInWindow: IntArray?,
    type: Int,
    consumed: IntArray
)

Dispatch one step of a nested scroll in progress.

Inherited functions

From androidx.core.view.NestedScrollingChild
Boolean
dispatchNestedFling(velocityX: Float, velocityY: Float, consumed: Boolean)

Dispatch a fling to a nested scrolling parent.

Boolean
dispatchNestedPreFling(velocityX: Float, velocityY: Float)

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

Boolean
dispatchNestedPreScroll(
    dx: Int,
    dy: Int,
    consumed: IntArray?,
    offsetInWindow: IntArray?
)

Dispatch one step of a nested scroll in progress before this view consumes any portion of it.

Boolean
dispatchNestedScroll(
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int,
    offsetInWindow: IntArray?
)

Dispatch one step of a nested scroll in progress.

Boolean

Returns true if this view has a nested scrolling parent.

Boolean

Returns true if nested scrolling is enabled for this view.

Unit

Enable or disable nested scrolling for this view.

Boolean

Begin a nestable scroll operation along the given axes.

Unit

Stop a nested scroll in progress.

From androidx.core.view.NestedScrollingChild2
Boolean
dispatchNestedPreScroll(
    dx: Int,
    dy: Int,
    consumed: IntArray?,
    offsetInWindow: IntArray?,
    type: Int
)

Dispatch one step of a nested scroll in progress before this view consumes any portion of it.

Boolean
dispatchNestedScroll(
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int,
    offsetInWindow: IntArray?,
    type: Int
)

Dispatch one step of a nested scroll in progress.

Boolean

Returns true if this view has a nested scrolling parent for the given input type.

Boolean
startNestedScroll(axes: Int, type: Int)

Begin a nestable scroll operation along the given axes, for the given input type.

Unit

Stop a nested scroll in progress for the given input type.

Public functions

dispatchNestedScroll

Added in 1.1.0
fun dispatchNestedScroll(
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int,
    offsetInWindow: IntArray?,
    type: Int,
    consumed: IntArray
): Unit

Dispatch one step of a nested scroll in progress.

Implementations of views that support nested scrolling should call this to report info about a scroll in progress to the current nested scrolling parent. If a nested scroll is not currently in progress or nested scrolling is not enabled for this view this method does nothing.

Compatible View implementations should also call dispatchNestedPreScroll before consuming a component of the scroll event themselves.

The original nested scrolling child (where the input events were received to start the scroll) must provide a non-null consumed parameter with values {0, 0}.

Parameters
dxConsumed: Int

Horizontal distance in pixels consumed by this view during this scroll step

dyConsumed: Int

Vertical distance in pixels consumed by this view during this scroll step

dxUnconsumed: Int

Horizontal scroll distance in pixels not consumed by this view

dyUnconsumed: Int

Horizontal scroll distance in pixels not consumed by this view

offsetInWindow: IntArray?

Optional. If not null, on return this will contain the offset in local view coordinates of this view from before this operation to after it completes. View implementations may use this to adjust expected input coordinate tracking.

type: Int

the type of input which cause this scroll event

consumed: IntArray

Output. Upon this method returning, will contain the original values plus any scroll distances consumed by all of this view's nested scrolling parents up the view hierarchy. Index 0 for the x dimension, and index 1 for the y dimension

See also
onNestedScroll