# NestedScrollingParent3

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

*** ** * ** ***

<br />

```
interface NestedScrollingParent3 : NestedScrollingParent2
```

<br />

Known direct subclasses [CoordinatorLayout](https://developer.android.com/reference/kotlin/androidx/coordinatorlayout/widget/CoordinatorLayout), [MotionLayout](https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionLayout), [NestedScrollView](https://developer.android.com/reference/kotlin/androidx/core/widget/NestedScrollView), [SwipeRefreshLayout](https://developer.android.com/reference/kotlin/androidx/swiperefreshlayout/widget/SwipeRefreshLayout)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/coordinatorlayout/widget/CoordinatorLayout` | CoordinatorLayout is a super-powered `https://developer.android.com/reference/android/widget/FrameLayout.html`. |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionLayout` | A subclass of ConstraintLayout that supports animating between various states **Added in 2.0** |
| `https://developer.android.com/reference/kotlin/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/kotlin/androidx/swiperefreshlayout/widget/SwipeRefreshLayout` | The SwipeRefreshLayout should be used whenever the user can refresh the contents of a view via a vertical swipe gesture. |

*** ** * ** ***

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

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

## Summary

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingParent3#onNestedScroll(android.view.View,int,int,int,int,int,int[])( target: https://developer.android.com/reference/android/view/View.html, dxConsumed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, dyConsumed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, dxUnconsumed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, dyUnconsumed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, type: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, consumed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html> )` React to a nested scroll in progress. |

### Inherited functions

From [androidx.core.view.NestedScrollingParent](https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingParent) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingParent#getNestedScrollAxes()()`

Return the current axes of nested scrolling for this NestedScrollingParent.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingParent#onNestedFling(android.view.View,float,float,boolean)(

target: https://developer.android.com/reference/android/view/View.html,

velocityX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html,

velocityY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html,

consumed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html

)`

Request a fling from a nested scroll.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingParent#onNestedPreFling(android.view.View,float,float)(target: https://developer.android.com/reference/android/view/View.html, velocityX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, velocityY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`

React to a nested fling before the target view consumes it.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingParent#onNestedPreScroll(android.view.View,int,int,int[])(target: https://developer.android.com/reference/android/view/View.html, dx: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, dy: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, consumed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>)`

React to a nested scroll in progress before the target view consumes a portion of the scroll.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingParent#onNestedScroll(android.view.View,int,int,int,int)(

target: https://developer.android.com/reference/android/view/View.html,

dxConsumed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html,

dyConsumed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html,

dxUnconsumed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html,

dyUnconsumed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html

)`

React to a nested scroll in progress.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingParent#onNestedScrollAccepted(android.view.View,android.view.View,int)(child: https://developer.android.com/reference/android/view/View.html, target: https://developer.android.com/reference/android/view/View.html, axes: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

React to the successful claiming of a nested scroll operation.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingParent#onStartNestedScroll(android.view.View,android.view.View,int)(child: https://developer.android.com/reference/android/view/View.html, target: https://developer.android.com/reference/android/view/View.html, axes: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

React to a descendant view initiating a nestable scroll operation, claiming the nested scroll operation if appropriate.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingParent#onStopNestedScroll(android.view.View)(target: https://developer.android.com/reference/android/view/View.html)`

React to a nested scroll operation ending.
From [androidx.core.view.NestedScrollingParent2](https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingParent2) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingParent2#onNestedPreScroll(android.view.View,int,int,int[],int)(

target: https://developer.android.com/reference/android/view/View.html,

dx: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html,

dy: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html,

consumed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>,

type: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html

)`

React to a nested scroll in progress before the target view consumes a portion of the scroll.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingParent2#onNestedScroll(android.view.View,int,int,int,int,int)(

target: https://developer.android.com/reference/android/view/View.html,

dxConsumed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html,

dyConsumed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html,

dxUnconsumed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html,

dyUnconsumed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html,

type: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html

)`

React to a nested scroll in progress.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingParent2#onNestedScrollAccepted(android.view.View,android.view.View,int,int)(child: https://developer.android.com/reference/android/view/View.html, target: https://developer.android.com/reference/android/view/View.html, axes: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, type: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

React to the successful claiming of a nested scroll operation.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingParent2#onStartNestedScroll(android.view.View,android.view.View,int,int)(child: https://developer.android.com/reference/android/view/View.html, target: https://developer.android.com/reference/android/view/View.html, axes: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, type: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

React to a descendant view initiating a nestable scroll operation, claiming the nested scroll operation if appropriate.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingParent2#onStopNestedScroll(android.view.View,int)(target: https://developer.android.com/reference/android/view/View.html, type: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

React to a nested scroll operation ending.

## Public functions

### onNestedScroll

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

```
fun onNestedScroll(
    target: View,
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int,
    type: Int,
    consumed: IntArray<Int>
): Unit
```

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 `https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingParent2#onStartNestedScroll(android.view.View,android.view.View,int,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.

This method is called when a nested scrolling child invokes `https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingChild3#dispatchNestedScroll(int,int,int,int,int[],int,int[])`} or one of methods it overloads.

An implementation must report how many pixels of the the x and y scroll distances were consumed by this nested scrolling parent by adding the consumed distances to the `consumed` parameter. If this View also implements `https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingChild3`, `consumed` should also be passed up to it's nested scrolling parent so that the parent may also add any scroll distance it consumes. Index 0 corresponds to dx and index 1 corresponds to dy.

| Parameters |
|---|---|
| `target: https://developer.android.com/reference/android/view/View.html` | The descendant view controlling the nested scroll |
| `dxConsumed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Horizontal scroll distance in pixels already consumed by target |
| `dyConsumed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Vertical scroll distance in pixels already consumed by target |
| `dxUnconsumed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Horizontal scroll distance in pixels not consumed by target |
| `dyUnconsumed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Vertical scroll distance in pixels not consumed by target |
| `type: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the type of input which cause this scroll event |
| `consumed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>` | Output. Upon this method returning, will contain the scroll distances consumed by this nested scrolling parent and the scroll distances consumed by any other parent up the view hierarchy |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingChild3#dispatchNestedScroll(int,int,int,int,int[],int,int[])` |   |