belongs to Maven artifact com.android.support:support-compat:28.0.0-alpha1
ViewParentCompat
public
final
class
ViewParentCompat
extends Object
java.lang.Object | |
↳ | android.support.v4.view.ViewParentCompat |
Helper for accessing features in ViewParent
.
Summary
Public methods | |
---|---|
static
void
|
notifySubtreeAccessibilityStateChanged(ViewParent parent, View child, View source, int changeType)
Notifies a view parent that the accessibility state of one of its descendants has changed and that the structure of the subtree is different. |
static
boolean
|
onNestedFling(ViewParent parent, View target, float velocityX, float velocityY, boolean consumed)
Request a fling from a nested scroll. |
static
boolean
|
onNestedPreFling(ViewParent parent, View target, float velocityX, float velocityY)
React to a nested fling before the target view consumes it. |
static
void
|
onNestedPreScroll(ViewParent parent, View target, int dx, int dy, int[] consumed, int type)
React to a nested scroll in progress before the target view consumes a portion of the scroll. |
static
void
|
onNestedPreScroll(ViewParent parent, View target, int dx, int dy, int[] consumed)
React to a nested scroll in progress before the target view consumes a portion of the scroll. |
static
void
|
onNestedScroll(ViewParent parent, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int type)
React to a nested scroll in progress. |
static
void
|
onNestedScroll(ViewParent parent, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed)
React to a nested scroll in progress. |
static
void
|
onNestedScrollAccepted(ViewParent parent, View child, View target, int nestedScrollAxes)
React to the successful claiming of a nested scroll operation. |
static
void
|
onNestedScrollAccepted(ViewParent parent, View child, View target, int nestedScrollAxes, int type)
React to the successful claiming of a nested scroll operation. |
static
boolean
|
onStartNestedScroll(ViewParent parent, View child, View target, int nestedScrollAxes, int type)
React to a descendant view initiating a nestable scroll operation, claiming the nested scroll operation if appropriate. |
static
boolean
|
onStartNestedScroll(ViewParent parent, View child, View target, int nestedScrollAxes)
React to a descendant view initiating a nestable scroll operation, claiming the nested scroll operation if appropriate. |
static
void
|
onStopNestedScroll(ViewParent parent, View target)
React to a nested scroll operation ending. |
static
void
|
onStopNestedScroll(ViewParent parent, View target, int type)
React to a nested scroll operation ending. |
static
boolean
|
requestSendAccessibilityEvent(ViewParent parent, View child, AccessibilityEvent event)
This method was deprecated
in API level 26.1.0.
Use |
Inherited methods | |
---|---|
![]()
java.lang.Object
|
Public methods
notifySubtreeAccessibilityStateChanged
void notifySubtreeAccessibilityStateChanged (ViewParent parent, View child, View source, int changeType)
Notifies a view parent that the accessibility state of one of its descendants has changed and that the structure of the subtree is different.
Parameters | |
---|---|
parent |
ViewParent |
child |
View : The direct child whose subtree has changed. |
source |
View : The descendant view that changed. |
changeType |
int : A bit mask of the types of changes that occurred. One
or more of:
|
onNestedFling
boolean onNestedFling (ViewParent parent, View target, float velocityX, float velocityY, boolean consumed)
Request a fling from a nested scroll.
This method signifies that a nested scrolling child has detected suitable conditions
for a fling. Generally this means that a touch scroll has ended with a
velocity
in the direction of scrolling that meets or exceeds
the minimum fling velocity
along a scrollable axis.
If a nested scrolling child view would normally fling but it is at the edge of its own content, it can use this method to delegate the fling to its nested scrolling parent instead. The parent may optionally consume the fling or observe a child fling.
Parameters | |
---|---|
parent |
ViewParent |
target |
View : View that initiated the nested scroll |
velocityX |
float : Horizontal velocity in pixels per second |
velocityY |
float : Vertical velocity in pixels per second |
consumed |
boolean : true if the child consumed the fling, false otherwise |
Returns | |
---|---|
boolean |
true if this parent consumed or otherwise reacted to the fling |
onNestedPreFling
boolean onNestedPreFling (ViewParent parent, View target, float velocityX, float velocityY)
React to a nested fling before the target view consumes it.
This method siginfies that a nested scrolling child has detected a fling with the given
velocity along each axis. Generally this means that a touch scroll has ended with a
velocity
in the direction of scrolling that meets or exceeds
the minimum fling velocity
along a scrollable axis.
If a nested scrolling parent is consuming motion as part of a
pre-scroll
, it may be
appropriate for it to also consume the pre-fling to complete that same motion. By returning
true
from this method, the parent indicates that the child should not
fling its own internal content as well.
Parameters | |
---|---|
parent |
ViewParent |
target |
View : View that initiated the nested scroll |
velocityX |
float : Horizontal velocity in pixels per second |
velocityY |
float : Vertical velocity in pixels per second |
Returns | |
---|---|
boolean |
true if this parent consumed the fling ahead of the target view |
onNestedPreScroll
void onNestedPreScroll (ViewParent parent, View target, int dx, int dy, int[] consumed, int type)
React to a nested scroll in progress before the target view consumes a portion of the scroll.
When working with nested scrolling often the parent view may want an opportunity to consume the scroll before the nested scrolling child does. An example of this is a drawer that contains a scrollable list. The user will want to be able to scroll the list fully into view before the list itself begins scrolling.
onNestedPreScroll
is called when a nested scrolling child invokes
dispatchNestedPreScroll(View, int, int, int[], int[])
. The implementation
should report how any pixels of the scroll reported by dx, dy were consumed in the
consumed
array. Index 0 corresponds to dx and index 1 corresponds to dy.
This parameter will never be null. Initial values for consumed[0] and consumed[1]
will always be 0.
Parameters | |
---|---|
parent |
ViewParent |
target |
View : View that initiated the nested scroll |
dx |
int : Horizontal scroll distance in pixels |
dy |
int : Vertical scroll distance in pixels |
consumed |
int : Output. The horizontal and vertical scroll distance consumed by this parent |
type |
int : the type of input which cause this scroll event
|
onNestedPreScroll
void onNestedPreScroll (ViewParent parent, View target, int dx, int dy, int[] consumed)
React to a nested scroll in progress before the target view consumes a portion of the scroll.
This version of the method just calls
onNestedPreScroll(ViewParent, View, int, int, int[], int)
using the touch input
type.
Parameters | |
---|---|
parent |
ViewParent |
target |
View : View that initiated the nested scroll |
dx |
int : Horizontal scroll distance in pixels |
dy |
int : Vertical scroll distance in pixels |
consumed |
int : Output. The horizontal and vertical scroll distance consumed by this parent
|
onNestedScroll
void onNestedScroll (ViewParent parent, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int type)
React to a nested scroll in progress.
This method will be called when the ViewParent's current nested scrolling child view
dispatches a nested scroll event. To receive calls to this method the ViewParent must have
previously returned true
for a call to
onStartNestedScroll(ViewParent, View, View, int, int)
.
Both the consumed and unconsumed portions of the scroll distance are reported to the ViewParent. An implementation may choose to use the consumed portion to match or chase scroll position of multiple child elements, for example. The unconsumed portion may be used to allow continuous dragging of multiple scrolling or draggable elements, such as scrolling a list within a vertical drawer where the drawer begins dragging once the edge of inner scrolling content is reached.
Parameters | |
---|---|
parent |
ViewParent |
target |
View : The descendent view controlling the nested scroll |
dxConsumed |
int : Horizontal scroll distance in pixels already consumed by target |
dyConsumed |
int : Vertical scroll distance in pixels already consumed by target |
dxUnconsumed |
int : Horizontal scroll distance in pixels not consumed by target |
dyUnconsumed |
int : Vertical scroll distance in pixels not consumed by target |
type |
int : the type of input which cause this scroll event
|
onNestedScroll
void onNestedScroll (ViewParent parent, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed)
React to a nested scroll in progress.
This version of the method just calls
onNestedScroll(ViewParent, View, int, int, int, int, int)
using the touch input
type.
Parameters | |
---|---|
parent |
ViewParent |
target |
View : The descendent view controlling the nested scroll |
dxConsumed |
int : Horizontal scroll distance in pixels already consumed by target |
dyConsumed |
int : Vertical scroll distance in pixels already consumed by target |
dxUnconsumed |
int : Horizontal scroll distance in pixels not consumed by target |
dyUnconsumed |
int : Vertical scroll distance in pixels not consumed by target
|
onNestedScrollAccepted
void onNestedScrollAccepted (ViewParent parent, View child, View target, int nestedScrollAxes)
React to the successful claiming of a nested scroll operation.
This version of the method just calls
onNestedScrollAccepted(ViewParent, View, View, int, int)
using the touch input type.
Parameters | |
---|---|
parent |
ViewParent |
child |
View : Direct child of this ViewParent containing target |
target |
View : View that initiated the nested scroll |
nestedScrollAxes |
int : Flags consisting of SCROLL_AXIS_HORIZONTAL ,
SCROLL_AXIS_VERTICAL or both
|
onNestedScrollAccepted
void onNestedScrollAccepted (ViewParent parent, View child, View target, int nestedScrollAxes, int type)
React to the successful claiming of a nested scroll operation.
This method will be called after
onStartNestedScroll
returns true.
It offers an opportunity for the view and its superclasses to perform initial configuration
for the nested scroll. Implementations of this method should always call their superclass's
implementation of this method if one is present.
Parameters | |
---|---|
parent |
ViewParent |
child |
View : Direct child of this ViewParent containing target |
target |
View : View that initiated the nested scroll |
nestedScrollAxes |
int : Flags consisting of SCROLL_AXIS_HORIZONTAL ,
SCROLL_AXIS_VERTICAL or both |
type |
int : the type of input which cause this scroll event |
onStartNestedScroll
boolean onStartNestedScroll (ViewParent parent, View child, View target, int nestedScrollAxes, int type)
React to a descendant view initiating a nestable scroll operation, claiming the nested scroll operation if appropriate.
This method will be called in response to a descendant view invoking
startNestedScroll(View, int)
. Each parent up the view hierarchy will be
given an opportunity to respond and claim the nested scrolling operation by returning
true
.
This method may be overridden by ViewParent implementations to indicate when th