# NestedScrollingChildHelper

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

*** ** * ** ***

<br />

```
class NestedScrollingChildHelper
```

<br />

*** ** * ** ***

Helper class for implementing nested scrolling child views compatible with Android platform versions earlier than Android 5.0 Lollipop (API 21).

`https://developer.android.com/reference/android/view/View.html` subclasses should instantiate a final instance of this class as a field at construction. For each `View` method that has a matching method signature in this class, delegate the operation to the helper instance in an overridden method implementation. This implements the standard framework policy for nested scrolling.

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

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingChildHelper#NestedScrollingChildHelper(android.view.View)(view: https://developer.android.com/reference/android/view/View.html)` Construct a new helper for a given view. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingChildHelper#dispatchNestedFling(float,float,boolean)(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)` Dispatch a nested fling operation to the current nested scrolling parent. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingChildHelper#dispatchNestedPreFling(float,float)(velocityX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, velocityY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Dispatch a nested pre-fling operation to the current nested scrolling parent. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingChildHelper#dispatchNestedPreScroll(int,int,int[],int[])( 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>?, offsetInWindow: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>? )` Dispatch one step of a nested pre-scrolling operation to the current nested scrolling parent. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingChildHelper#dispatchNestedPreScroll(int,int,int[],int[],int)( 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>?, offsetInWindow: 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 )` Dispatch one step of a nested pre-scrolling operation to the current nested scrolling parent. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingChildHelper#dispatchNestedScroll(int,int,int,int,int[])( 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, offsetInWindow: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>? )` Dispatch one step of a nested scrolling operation to the current nested scrolling parent. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingChildHelper#dispatchNestedScroll(int,int,int,int,int[],int)( 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, offsetInWindow: 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 )` Dispatch one step of a nested scrolling operation to the current nested scrolling parent. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingChildHelper#dispatchNestedScroll(int,int,int,int,int[],int,int[])( 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, offsetInWindow: 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, consumed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>? )` Dispatch one step of a nested scrolling operation to the current nested scrolling parent. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingChildHelper#hasNestedScrollingParent()()` Check if this view has a nested scrolling parent view currently receiving events for a nested scroll in progress with the type of touch. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingChildHelper#hasNestedScrollingParent(int)(type: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Check if this view has a nested scrolling parent view currently receiving events for a nested scroll in progress with the given type. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingChildHelper#isNestedScrollingEnabled()()` Check if nested scrolling is enabled for this view. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingChildHelper#onDetachedFromWindow()()` View subclasses should always call this method on their `NestedScrollingChildHelper` when detached from a window. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingChildHelper#onStopNestedScroll(android.view.View)(child: https://developer.android.com/reference/android/view/View.html)` Called when a nested scrolling child stops its current nested scroll operation. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingChildHelper#setNestedScrollingEnabled(boolean)(enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Enable nested scrolling. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingChildHelper#startNestedScroll(int)(axes: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Start a new nested scroll for this view. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingChildHelper#startNestedScroll(int,int)(axes: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, type: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Start a new nested scroll for this view. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingChildHelper#stopNestedScroll()()` Stop 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/NestedScrollingChildHelper#stopNestedScroll(int)(type: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Stop a nested scroll in progress. |

## Public constructors

### NestedScrollingChildHelper

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

```
NestedScrollingChildHelper(view: View)
```

Construct a new helper for a given view.

## Public functions

### dispatchNestedFling

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

```
fun dispatchNestedFling(velocityX: Float, velocityY: Float, consumed: Boolean): Boolean
```

Dispatch a nested fling operation to the current nested scrolling parent.

This is a delegate method. Call it from your `https://developer.android.com/reference/android/view/View.html` subclass method/`https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingChild` interface method with the same signature to implement the standard policy.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | true if the parent consumed the nested fling |

### dispatchNestedPreFling

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

```
fun dispatchNestedPreFling(velocityX: Float, velocityY: Float): Boolean
```

Dispatch a nested pre-fling operation to the current nested scrolling parent.

This is a delegate method. Call it from your `https://developer.android.com/reference/android/view/View.html` subclass method/`https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingChild` interface method with the same signature to implement the standard policy.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | true if the parent consumed the nested fling |

### dispatchNestedPreScroll

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

```
fun dispatchNestedPreScroll(
    dx: Int,
    dy: Int,
    consumed: IntArray<Int>?,
    offsetInWindow: IntArray<Int>?
): Boolean
```

Dispatch one step of a nested pre-scrolling operation to the current nested scrolling parent.

This is a delegate method. Call it from your `https://developer.android.com/reference/android/view/View.html` subclass method/`https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingChild` interface method with the same signature to implement the standard policy.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | true if the parent consumed any of the nested scroll |

### dispatchNestedPreScroll

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

```
fun dispatchNestedPreScroll(
    dx: Int,
    dy: Int,
    consumed: IntArray<Int>?,
    offsetInWindow: IntArray<Int>?,
    type: Int
): Boolean
```

Dispatch one step of a nested pre-scrolling operation to the current nested scrolling parent.

This is a delegate method. Call it from your `https://developer.android.com/reference/android/view/View.html` subclass method/`https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingChild2` interface method with the same signature to implement the standard policy.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | true if the parent consumed any of the nested scroll |

### dispatchNestedScroll

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

```
fun dispatchNestedScroll(
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int,
    offsetInWindow: IntArray<Int>?
): Boolean
```

Dispatch one step of a nested scrolling operation to the current nested scrolling parent.

This is a delegate method. Call it from your `https://developer.android.com/reference/android/view/View.html` subclass method/`https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingChild` interface method with the same signature to implement the standard policy.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if the parent consumed any of the nested scroll distance |

### dispatchNestedScroll

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

```
fun dispatchNestedScroll(
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int,
    offsetInWindow: IntArray<Int>?,
    type: Int
): Boolean
```

Dispatch one step of a nested scrolling operation to the current nested scrolling parent.

This is a delegate method. Call it from your `https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingChild2` interface method with the same signature to implement the standard policy.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if the parent consumed any of the nested scroll distance |

### dispatchNestedScroll

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

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

Dispatch one step of a nested scrolling operation to the current nested scrolling parent.

This is a delegate method. Call it from your `https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingChild3` interface method with the same signature to implement the standard policy.

### hasNestedScrollingParent

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

```
fun hasNestedScrollingParent(): Boolean
```

Check if this view has a nested scrolling parent view currently receiving events for a nested scroll in progress with the type of touch.

This is a delegate method. Call it from your `https://developer.android.com/reference/android/view/View.html` subclass method/`https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingChild` interface method with the same signature to implement the standard policy.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | true if this view has a nested scrolling parent, false otherwise |

### hasNestedScrollingParent

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

```
fun hasNestedScrollingParent(type: Int): Boolean
```

Check if this view has a nested scrolling parent view currently receiving events for a nested scroll in progress with the given type.

This is a delegate method. Call it from your `https://developer.android.com/reference/android/view/View.html` subclass method/`https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingChild` interface method with the same signature to implement the standard policy.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | true if this view has a nested scrolling parent, false otherwise |

### isNestedScrollingEnabled

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

```
fun isNestedScrollingEnabled(): Boolean
```

Check if nested scrolling is enabled for this view.

This is a delegate method. Call it from your `https://developer.android.com/reference/android/view/View.html` subclass method/`https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingChild` interface method with the same signature to implement the standard policy.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | true if nested scrolling is enabled for this view |

### onDetachedFromWindow

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

```
fun onDetachedFromWindow(): Unit
```

View subclasses should always call this method on their `NestedScrollingChildHelper` when detached from a window.

This is a delegate method. Call it from your `https://developer.android.com/reference/android/view/View.html` subclass method/`https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingChild` interface method with the same signature to implement the standard policy.

### onStopNestedScroll

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

```
fun onStopNestedScroll(child: View): Unit
```

Called when a nested scrolling child stops its current nested scroll operation.

This is a delegate method. Call it from your `https://developer.android.com/reference/android/view/View.html` subclass method/`https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingChild` interface method with the same signature to implement the standard policy.

| Parameters |
|---|---|
| `child: https://developer.android.com/reference/android/view/View.html` | Child view stopping its nested scroll. This may not be a direct child view. |

### setNestedScrollingEnabled

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

```
fun setNestedScrollingEnabled(enabled: Boolean): Unit
```

Enable nested scrolling.

This is a delegate method. Call it from your `https://developer.android.com/reference/android/view/View.html` subclass method/`https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingChild` interface method with the same signature to implement the standard policy.

| Parameters |
|---|---|
| `enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | true to enable nested scrolling dispatch from this view, false otherwise |

### startNestedScroll

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

```
fun startNestedScroll(axes: Int): Boolean
```

Start a new nested scroll for this view.

This is a delegate method. Call it from your `https://developer.android.com/reference/android/view/View.html` subclass method/`https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingChild` interface method with the same signature to implement the standard policy.

| Parameters |
|---|---|
| `axes: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Supported nested scroll axes. See `https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingChild#startNestedScroll(int)`. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | true if a cooperating parent view was found and nested scrolling started successfully |

### startNestedScroll

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

```
fun startNestedScroll(axes: Int, type: Int): Boolean
```

Start a new nested scroll for this view.

This is a delegate method. Call it from your `https://developer.android.com/reference/android/view/View.html` subclass method/`https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingChild2` interface method with the same signature to implement the standard policy.

| Parameters |
|---|---|
| `axes: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Supported nested scroll axes. See `https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingChild2#startNestedScroll(int,int)`. |
| `type: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | type of the scroll. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | true if a cooperating parent view was found and nested scrolling started successfully |

### stopNestedScroll

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

```
fun stopNestedScroll(): Unit
```

Stop a nested scroll in progress.

This is a delegate method. Call it from your `https://developer.android.com/reference/android/view/View.html` subclass method/`https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingChild` interface method with the same signature to implement the standard policy.

### stopNestedScroll

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

```
fun stopNestedScroll(type: Int): Unit
```

Stop a nested scroll in progress.

This is a delegate method. Call it from your `https://developer.android.com/reference/android/view/View.html` subclass method/`https://developer.android.com/reference/kotlin/androidx/core/view/NestedScrollingChild2` interface method with the same signature to implement the standard policy.