Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

NestedScrollingParentHelper

open class NestedScrollingParentHelper
kotlin.Any
   ↳ androidx.core.view.NestedScrollingParentHelper

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

ViewGroup 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 androidx.core.view.ViewCompat, androidx.core.view.ViewGroupCompat or 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

<init>(@NonNull viewGroup: ViewGroup)

Construct a new helper for a given ViewGroup

Public methods

open Int

Return the current axes of nested scrolling for this ViewGroup.

open Unit
onNestedScrollAccepted(@NonNull child: View, @NonNull target: View, axes: Int)

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

open Unit
onNestedScrollAccepted(@NonNull child: View, @NonNull target: View, axes: Int, type: Int)

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

open Unit
onStopNestedScroll(@NonNull target: View)

React to a nested scroll operation ending.

open Unit
onStopNestedScroll(@NonNull target: View, type: Int)

React to a nested scroll operation ending.

Public constructors

<init>

NestedScrollingParentHelper(@NonNull viewGroup: ViewGroup)

Construct a new helper for a given ViewGroup

Public methods

getNestedScrollAxes

open fun getNestedScrollAxes(): Int

Return the current axes of nested scrolling for this ViewGroup.

This is a delegate method. Call it from your ViewGroup subclass method/androidx.core.view.NestedScrollingParent interface method with the same signature to implement the standard policy.

onNestedScrollAccepted

open fun onNestedScrollAccepted(@NonNull child: View, @NonNull target: View, axes: Int): Unit

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 ViewGroup subclass method/androidx.core.view.NestedScrollingParent interface method with the same signature to implement the standard policy.

onNestedScrollAccepted

open fun onNestedScrollAccepted(@NonNull child: View, @NonNull target: View, axes: Int, type: Int): Unit

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 ViewGroup subclass method/androidx.core.view.NestedScrollingParent2 interface method with the same signature to implement the standard policy.

onStopNestedScroll

open fun onStopNestedScroll(@NonNull target: View): Unit

React to a nested scroll operation ending.

This is a delegate method. Call it from your ViewGroup subclass method/androidx.core.view.NestedScrollingParent interface method with the same signature to implement the standard policy.

onStopNestedScroll

open fun onStopNestedScroll(@NonNull target: View, type: Int): Unit

React to a nested scroll operation ending.

This is a delegate method. Call it from your ViewGroup subclass method/androidx.core.view.NestedScrollingParent2 interface method with the same signature to implement the standard policy.