public class NestedScrollingChildHelper extends Object
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.
Constructor and Description |
---|
NestedScrollingChildHelper(View view)
Construct a new helper for a given view.
|
Modifier and Type | Method and Description |
---|---|
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 |
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.
|
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.
|
void |
stopNestedScroll()
Stop a nested scroll in progress.
|
public NestedScrollingChildHelper(View view)
public void setNestedScrollingEnabled(boolean enabled)
This is a delegate method. Call it from your View
subclass
method/NestedScrollingChild
interface method with the same
signature to implement the standard policy.
enabled
- true to enable nested scrolling dispatch from this view, false otherwisepublic boolean isNestedScrollingEnabled()
This is a delegate method. Call it from your View
subclass
method/NestedScrollingChild
interface method with the same
signature to implement the standard policy.
public boolean hasNestedScrollingParent()
This is a delegate method. Call it from your View
subclass
method/NestedScrollingChild
interface method with the same
signature to implement the standard policy.
public boolean startNestedScroll(int axes)
This is a delegate method. Call it from your View
subclass
method/NestedScrollingChild
interface method with the same
signature to implement the standard policy.
axes
- Supported nested scroll axes.
See NestedScrollingChild.startNestedScroll(int)
.public void stopNestedScroll()
This is a delegate method. Call it from your View
subclass
method/NestedScrollingChild
interface method with the same
signature to implement the standard policy.
public boolean dispatchNestedScroll(int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int[] offsetInWindow)
This is a delegate method. Call it from your View
subclass
method/NestedScrollingChild
interface method with the same
signature to implement the standard policy.
public boolean dispatchNestedPreScroll(int dx, int dy, int[] consumed, int[] offsetInWindow)
This is a delegate method. Call it from your View
subclass
method/NestedScrollingChild
interface method with the same
signature to implement the standard policy.
public boolean dispatchNestedFling(float velocityX, float velocityY, boolean consumed)
This is a delegate method. Call it from your View
subclass
method/NestedScrollingChild
interface method with the same
signature to implement the standard policy.
public boolean dispatchNestedPreFling(float velocityX, float velocityY)
This is a delegate method. Call it from your View
subclass
method/NestedScrollingChild
interface method with the same
signature to implement the standard policy.
public void onDetachedFromWindow()
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.
public void onStopNestedScroll(View child)
This is a delegate method. Call it from your View
subclass
method/NestedScrollingChild
interface method with the same
signature to implement the standard policy.
child
- Child view stopping its nested scroll. This may not be a direct child view.