# NestedScrollingParentHelper

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

*** ** * ** ***


```
public class NestedScrollingParentHelper
```

<br />

*** ** * ** ***

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

`https://developer.android.com/reference/android/view/ViewGroup.html` subclasses should instantiate a final instance of this class as a field at construction. For each `ViewGroup` 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/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 Android 5.0 Lollipop and newer.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/core/view/NestedScrollingParentHelper#NestedScrollingParentHelper(android.view.ViewGroup)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/ViewGroup.html viewGroup)` Construct a new helper for a given ViewGroup |

| ### Public methods |
|---|---|
| `int` | `https://developer.android.com/reference/androidx/core/view/NestedScrollingParentHelper#getNestedScrollAxes()()` Return the current axes of nested scrolling for this ViewGroup. |
| `void` | `https://developer.android.com/reference/androidx/core/view/NestedScrollingParentHelper#onNestedScrollAccepted(android.view.View,android.view.View,int)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html child, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html target, int axes)` Called when a nested scrolling operation initiated by a descendant view is accepted by this ViewGroup. |
| `void` | `https://developer.android.com/reference/androidx/core/view/NestedScrollingParentHelper#onNestedScrollAccepted(android.view.View,android.view.View,int,int)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html child, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html target, int axes, int type )` Called when a nested scrolling operation initiated by a descendant view is accepted by this ViewGroup. |
| `void` | `https://developer.android.com/reference/androidx/core/view/NestedScrollingParentHelper#onStopNestedScroll(android.view.View)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html target)` React to a nested scroll operation ending. |
| `void` | `https://developer.android.com/reference/androidx/core/view/NestedScrollingParentHelper#onStopNestedScroll(android.view.View,int)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html target, int type)` React to a nested scroll operation ending. |

## Public constructors

### NestedScrollingParentHelper

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

```
public NestedScrollingParentHelper(@NonNull ViewGroup viewGroup)
```

Construct a new helper for a given ViewGroup

## Public methods

### getNestedScrollAxes

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

```
public int getNestedScrollAxes()
```

Return the current axes of nested scrolling for this ViewGroup.

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

### onNestedScrollAccepted

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

```
public void onNestedScrollAccepted(@NonNull View child, @NonNull View target, int axes)
```

Called when a nested scrolling operation initiated by a descendant view is accepted by this ViewGroup.

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

### onNestedScrollAccepted

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

```
public void onNestedScrollAccepted(
    @NonNull View child,
    @NonNull View target,
    int axes,
    int type
)
```

Called when a nested scrolling operation initiated by a descendant view is accepted by this ViewGroup.

This is a delegate method. Call it from your `https://developer.android.com/reference/android/view/ViewGroup.html` subclass method/`https://developer.android.com/reference/androidx/core/view/NestedScrollingParent2` 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)

```
public void onStopNestedScroll(@NonNull View target)
```

React to a nested scroll operation ending.

This is a delegate method. Call it from your `https://developer.android.com/reference/android/view/ViewGroup.html` subclass method/`https://developer.android.com/reference/androidx/core/view/NestedScrollingParent` 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)

```
public void onStopNestedScroll(@NonNull View target, int type)
```

React to a nested scroll operation ending.

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