# NestedScrollingChild3

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/view/NestedScrollingChild3.java+class:androidx.core.view.NestedScrollingChild3) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

*** ** * ** ***


```
public interface NestedScrollingChild3 extends NestedScrollingChild2
```

<br />

Known direct subclasses [NestedScrollView](https://developer.android.com/reference/androidx/core/widget/NestedScrollView), [RecyclerView](https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView), [SwipeRefreshLayout](https://developer.android.com/reference/androidx/swiperefreshlayout/widget/SwipeRefreshLayout)

|---|---|
| `https://developer.android.com/reference/androidx/core/widget/NestedScrollView` | NestedScrollView is just like `https://developer.android.com/reference/android/widget/ScrollView.html`, but it supports acting as both a nested scrolling parent and child on both new and old versions of Android. |
| `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView` | A flexible view for providing a limited window into a large data set. |
| `https://developer.android.com/reference/androidx/swiperefreshlayout/widget/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](https://developer.android.com/reference/androidx/leanback/widget/BaseGridView), [HorizontalGridView](https://developer.android.com/reference/androidx/leanback/widget/HorizontalGridView), [VerticalGridView](https://developer.android.com/reference/androidx/leanback/widget/VerticalGridView), [WearableRecyclerView](https://developer.android.com/reference/androidx/wear/widget/WearableRecyclerView)

|---|---|
| `https://developer.android.com/reference/androidx/leanback/widget/BaseGridView` | An abstract base class for vertically and horizontally scrolling lists. |
| `https://developer.android.com/reference/androidx/leanback/widget/HorizontalGridView` | A `https://developer.android.com/reference/android/view/ViewGroup.html` that shows items in a horizontal scrolling list. |
| `https://developer.android.com/reference/androidx/leanback/widget/VerticalGridView` | A `https://developer.android.com/reference/android/view/ViewGroup.html` that shows items in a vertically scrolling list. |
| `https://developer.android.com/reference/androidx/wear/widget/WearableRecyclerView` | Wearable specific implementation of the `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView` enabling `https://developer.android.com/reference/androidx/wear/widget/WearableRecyclerView#setCircularScrollingGestureEnabled(boolean)` circular scrolling} and semi-circular layouts. |

*** ** * ** ***

This interface should be implemented by `https://developer.android.com/reference/android/view/View.html` subclasses that wish to support dispatching nested scrolling operations to a cooperating parent `https://developer.android.com/reference/android/view/ViewGroup.html`.

Classes implementing this interface should create a final instance of a `https://developer.android.com/reference/androidx/core/view/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 `https://developer.android.com/reference/androidx/core/view/ViewCompat`, `https://developer.android.com/reference/androidx/core/view/ViewGroupCompat` or `https://developer.android.com/reference/androidx/core/view/ViewParentCompat` compatibility shim static methods. This ensures interoperability with nested scrolling views on all versions of Android.

## Summary

| ### Public methods |
|---|---|
| `abstract void` | `https://developer.android.com/reference/androidx/core/view/NestedScrollingChild3#dispatchNestedScroll(int,int,int,int,int[],int,int[])( int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html int[] offsetInWindow, int type, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html int[] consumed )` Dispatch one step of a nested scroll in progress. |

| ### Inherited methods |
|---|
| From [androidx.core.view.NestedScrollingChild](https://developer.android.com/reference/androidx/core/view/NestedScrollingChild) |---|---| | `abstract boolean` | `https://developer.android.com/reference/androidx/core/view/NestedScrollingChild#dispatchNestedFling(float,float,boolean)(float velocityX, float velocityY, boolean consumed)` Dispatch a fling to a nested scrolling parent. | | `abstract boolean` | `https://developer.android.com/reference/androidx/core/view/NestedScrollingChild#dispatchNestedPreFling(float,float)(float velocityX, float velocityY)` Dispatch a fling to a nested scrolling parent before it is processed by this view. | | `abstract boolean` | `https://developer.android.com/reference/androidx/core/view/NestedScrollingChild#dispatchNestedPreScroll(int,int,int[],int[])( int dx, int dy, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html int[] consumed, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html int[] offsetInWindow )` Dispatch one step of a nested scroll in progress before this view consumes any portion of it. | | `abstract boolean` | `https://developer.android.com/reference/androidx/core/view/NestedScrollingChild#dispatchNestedScroll(int,int,int,int,int[])( int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html int[] offsetInWindow )` Dispatch one step of a nested scroll in progress. | | `abstract boolean` | `https://developer.android.com/reference/androidx/core/view/NestedScrollingChild#hasNestedScrollingParent()()` Returns true if this view has a nested scrolling parent. | | `abstract boolean` | `https://developer.android.com/reference/androidx/core/view/NestedScrollingChild#isNestedScrollingEnabled()()` Returns true if nested scrolling is enabled for this view. | | `abstract void` | `https://developer.android.com/reference/androidx/core/view/NestedScrollingChild#setNestedScrollingEnabled(boolean)(boolean enabled)` Enable or disable nested scrolling for this view. | | `abstract boolean` | `https://developer.android.com/reference/androidx/core/view/NestedScrollingChild#startNestedScroll(int)(int axes)` Begin a nestable scroll operation along the given axes. | | `abstract void` | `https://developer.android.com/reference/androidx/core/view/NestedScrollingChild#stopNestedScroll()()` Stop a nested scroll in progress. | |
| From [androidx.core.view.NestedScrollingChild2](https://developer.android.com/reference/androidx/core/view/NestedScrollingChild2) |---|---| | `abstract boolean` | `https://developer.android.com/reference/androidx/core/view/NestedScrollingChild2#dispatchNestedPreScroll(int,int,int[],int[],int)( int dx, int dy, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html int[] consumed, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html int[] offsetInWindow, int type )` Dispatch one step of a nested scroll in progress before this view consumes any portion of it. | | `abstract boolean` | `https://developer.android.com/reference/androidx/core/view/NestedScrollingChild2#dispatchNestedScroll(int,int,int,int,int[],int)( int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html int[] offsetInWindow, int type )` Dispatch one step of a nested scroll in progress. | | `abstract boolean` | `https://developer.android.com/reference/androidx/core/view/NestedScrollingChild2#hasNestedScrollingParent(int)(int type)` Returns true if this view has a nested scrolling parent for the given input type. | | `abstract boolean` | `https://developer.android.com/reference/androidx/core/view/NestedScrollingChild2#startNestedScroll(int,int)(int axes, int type)` Begin a nestable scroll operation along the given axes, for the given input type. | | `abstract void` | `https://developer.android.com/reference/androidx/core/view/NestedScrollingChild2#stopNestedScroll(int)(int type)` Stop a nested scroll in progress for the given input type. | |

## Public methods

### dispatchNestedScroll

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
abstract void dispatchNestedScroll(
    int dxConsumed,
    int dyConsumed,
    int dxUnconsumed,
    int dyUnconsumed,
    @Nullable int[] offsetInWindow,
    int type,
    @NonNull int[] consumed
)
```

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 `https://developer.android.com/reference/androidx/core/view/NestedScrollingChild#isNestedScrollingEnabled()` for this view this method does nothing.

Compatible View implementations should also call `https://developer.android.com/reference/androidx/core/view/NestedScrollingChild2#dispatchNestedPreScroll(int,int,int[],int[],int)` 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 |
|---|---|
| `int dxConsumed` | Horizontal distance in pixels consumed by this view during this scroll step |
| `int dyConsumed` | Vertical distance in pixels consumed by this view during this scroll step |
| `int dxUnconsumed` | Horizontal scroll distance in pixels not consumed by this view |
| `int dyUnconsumed` | Horizontal scroll distance in pixels not consumed by this view |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html int[] offsetInWindow` | 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. |
| `int type` | the type of input which cause this scroll event |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html int[] consumed` | 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 |
|---|---|
| `https://developer.android.com/reference/androidx/core/view/NestedScrollingParent3#onNestedScroll(android.view.View,int,int,int,int,int,int[])` |   |