added in version 22.1.0
belongs to Maven artifact com.android.support:support-compat:28.0.0-alpha1

NestedScrollingChildHelper

public class NestedScrollingChildHelper
extends Object

java.lang.Object
   ↳ android.support.v4.view.NestedScrollingChildHelper


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

View 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 ViewCompat, ViewGroupCompat or ViewParentCompat compatibility shim static methods. This ensures interoperability with nested scrolling views on Android 5.0 Lollipop and newer.

Summary

Public constructors

NestedScrollingChildHelper(View view)

Construct a new helper for a given view.

Public methods

boolean dispatchNestedFling(float velocityX, float velocityY, boolean consumed)

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

boolean dispatchNestedPreFling(float velocityX, float velocityY)

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

boolean dispatchNestedPreScroll(int dx, int dy, int[] consumed, int[] offsetInWindow)

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

boolean dispatchNestedPreScroll(int dx, int dy, int[] consumed, int[] offsetInWindow, int type)

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

boolean dispatchNestedScroll(int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int[] offsetInWindow, int type)

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

boolean dispatchNestedScroll(int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int[] offsetInWindow)

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

boolean 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.

boolean hasNestedScrollingParent(int type)

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

boolean isNestedScrollingEnabled()

Check if nested scrolling is enabled for this view.

void onDetachedFromWindow()

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

void onStopNestedScroll(View child)

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

void setNestedScrollingEnabled(boolean enabled)

Enable nested scrolling.

boolean startNestedScroll(int axes)

Start a new nested scroll for this view.

boolean startNestedScroll(int axes, int type)

Start a new nested scroll for this view.

void stopNestedScroll()

Stop a nested scroll in progress.

void stopNestedScroll(int type)

Stop a nested scroll in progress.

Inherited methods

From class java.lang.Object

Public constructors

NestedScrollingChildHelper

added in version 22.1.0
NestedScrollingChildHelper (View view)

Construct a new helper for a given view.

Parameters
view View

Public methods

dispatchNestedFling

added in version 22.1.0
boolean dispatchNestedFling (float velocityX, 
                float velocityY, 
                boolean consumed)

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

This is a delegate method. Call it from your View subclass method/NestedScrollingChild interface method with the same signature to implement the standard policy.

Parameters
velocityX float

velocityY float

consumed boolean

Returns
boolean true if the parent consumed the nested fling

dispatchNestedPreFling

added in version 22.1.0
boolean dispatchNestedPreFling (float velocityX, 
                float velocityY)

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

This is a delegate method. Call it from your View subclass method/NestedScrollingChild interface method with the same signature to implement the standard policy.

Parameters
velocityX float

velocityY float

Returns
boolean true if the parent consumed the nested fling

dispatchNestedPreScroll

added in version 22.1.0
boolean dispatchNestedPreScroll (int dx, 
                int dy, 
                int[] consumed, 
                int[] offsetInWindow)

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

This is a delegate method. Call it from your View subclass method/NestedScrollingChild interface method with the same signature to implement the standard policy.

Parameters
dx int

dy int

consumed int

offsetInWindow int

Returns
boolean true if the parent consumed any of the nested scroll

dispatchNestedPreScroll

added in version 26.1.0
boolean dispatchNestedPreScroll (int dx, 
                int dy, 
                int[] consumed, 
                int[] offsetInWindow, 
                int type)

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

This is a delegate method. Call it from your View subclass method/NestedScrollingChild2 interface method with the same signature to implement the standard policy.

Parameters
dx int

dy int

consumed int

offsetInWindow int

type int

Returns
boolean true if the parent consumed any of the nested scroll

dispatchNestedScroll

added in version 26.1.0
boolean dispatchNestedScroll (int dxConsumed, 
                int dyConsumed, 
                int dxUnconsumed, 
                int dyUnconsumed, 
                int[] offsetInWindow, 
                int type)

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

This is a delegate method. Call it from your View subclass method/NestedScrollingChild2 interface method with the same signature to implement the standard policy.

Parameters
dxConsumed int

dyConsumed int

dxUnconsumed int

dyUnconsumed int

offsetInWindow int

type int

Returns
boolean true if the parent consumed any of the nested scroll

dispatchNestedScroll

added in version 22.1.0
boolean dispatchNestedScroll (int dxConsumed, 
                int dyConsumed, 
                int dxUnconsumed, 
                int dyUnconsumed, 
                int[] offsetInWindow)

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

This is a delegate method. Call it from your View subclass method/NestedScrollingChild interface method with the same signature to implement the standard policy.

Parameters
dxConsumed int

dyConsumed int

dxUnconsumed int

dyUnconsumed int

offsetInWindow int

Returns
boolean true if the parent consumed any of the nested scroll

hasNestedScrollingParent

added in version 22.1.0
boolean 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.

This is a delegate method. Call it from your View subclass method/NestedScrollingChild interface method with the same signature to implement the standard policy.

Returns
boolean true if this view has a nested scrolling parent, false otherwise

hasNestedScrollingParent

added in version 26.1.0
boolean hasNestedScrollingParent (int type)

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 View subclass method/NestedScrollingChild interface method with the same signature to implement the standard policy.

Parameters
type int

Returns
boolean true if this view has a nested scrolling parent, false otherwise

isNestedScrollingEnabled

added in version 22.1.0
boolean isNestedScrollingEnabled ()

Check if nested scrolling is enabled for this view.

This is a delegate method. Call it from your View subclass method/NestedScrollingChild interface method with the same signature to implement the standard policy.

Returns
boolean true if nested scrolling is enabled for this view

onDetachedFromWindow

added in version 22.1.0
void onDetachedFromWindow ()

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

This is a delegate method. Call it from your View subclass method/NestedScrollingChild interface method with the same signature to implement the standard policy.

onStopNestedScroll

added in version 22.1.0
void onStopNestedScroll (View child)

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

This is a delegate method. Call it from your View subclass method/NestedScrollingChild interface method with the same signature to implement the standard policy.

Parameters
child View: Child view stopping its nested scroll. This may not be a direct child view.

setNestedScrollingEnabled

added in version 22.1.0
void setNestedScrollingEnabled (boolean enabled)

Enable nested scrolling.

This is a delegate method. Call it from your View subclass method/NestedScrollingChild interface method with the same signature to implement the standard policy.

Parameters
enabled boolean: true to enable nested scrolling dispatch from this view, false otherwise

startNestedScroll

added in version 22.1.0
boolean startNestedScroll (int axes)

Start a new nested scroll for this view.

This is a delegate method. Call it from your View subclass method/NestedScrollingChild interface method with the same signature to implement the standard policy.

Parameters
axes int: Supported nested scroll axes. See startNestedScroll(int).

Returns
boolean true if a cooperating parent view was found and nested scrolling started successfully

startNestedScroll

added in version 26.1.0
boolean startNestedScroll (int axes, 
                int type)

Start a new nested scroll for this view.

This is a delegate method. Call it from your View subclass method/NestedScrollingChild2 interface method with the same signature to implement the standard policy.

Parameters
axes int: Supported nested scroll axes. See startNestedScroll(int, int).

type int

Returns
boolean true if a cooperating parent view was found and nested scrolling started successfully

stopNestedScroll

added in version 22.1.0
void stopNestedScroll ()

Stop a nested scroll in progress.

This is a delegate method. Call it from your View subclass method/NestedScrollingChild interface method with the same signature to implement the standard policy.

stopNestedScroll

added in version 26.1.0
void stopNestedScroll (int type)

Stop a nested scroll in progress.

This is a delegate method. Call it from your View subclass method/NestedScrollingChild2 interface method with the same signature to implement the standard policy.

Parameters
type int