Package 

Class ViewParentCompat

    • Method Summary

      Modifier and Type Method Description
      static boolean requestSendAccessibilityEvent(ViewParent parent, View child, AccessibilityEvent event) Called by a child to request from its parent to send an AccessibilityEvent.The child has already populated a record for itself in the event and is delegatingto its parent to send the event.
      static boolean onStartNestedScroll(ViewParent parent, View child, View target, int nestedScrollAxes) React to a descendant view initiating a nestable scroll operation, claiming thenested scroll operation if appropriate.
      static void onNestedScrollAccepted(ViewParent parent, View child, View target, int nestedScrollAxes) React to the successful claiming of a nested scroll operation.
      static void onStopNestedScroll(ViewParent parent, View target) React to a nested scroll operation ending.
      static void onNestedScroll(ViewParent parent, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) React to a nested scroll in progress.
      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 onNestedPreScroll(ViewParent parent, View target, int dx, int dy, Array<int> consumed) React to a nested scroll in progress before the target view consumes a portion of the scroll.
      static boolean onStartNestedScroll(ViewParent parent, View child, View target, int nestedScrollAxes, int type) React to a descendant view initiating a nestable scroll operation, claiming thenested scroll operation if appropriate.
      static void onNestedScrollAccepted(ViewParent parent, View child, View target, int nestedScrollAxes, int type) React to the successful claiming of a nested scroll operation.
      static void onStopNestedScroll(ViewParent parent, View target, int type) React to a nested scroll operation ending.
      static void onNestedScroll(ViewParent parent, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int type, @NonNull() Array<int> consumed) React to a nested scroll in progress.
      static void onNestedPreScroll(ViewParent parent, View target, int dx, int dy, Array<int> consumed, int type) React to a nested scroll in progress before the target view consumes a portion of the scroll.
      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 notifySubtreeAccessibilityStateChanged(ViewParent parent, View child, View source, int changeType) Notifies a view parent that the accessibility state of one of itsdescendants has changed and that the structure of the subtree isdifferent.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • requestSendAccessibilityEvent

        @Deprecated() static boolean requestSendAccessibilityEvent(ViewParent parent, View child, AccessibilityEvent event)

        Called by a child to request from its parent to send an AccessibilityEvent.The child has already populated a record for itself in the event and is delegatingto its parent to send the event. The parent can optionally add a record for itself.

        Note: An accessibility event is fired by an individual view which populates theevent with a record for its state and requests from its parent to performthe sending. The parent can optionally add a record for itself beforedispatching the request to its parent. A parent can also choose not torespect the request for sending the event. The accessibility event is sentby the topmost view in the view tree.

        Parameters:
        parent - The parent whose method to invoke.
        child - The child which requests sending the event.
        event - The event to be sent.
      • onStartNestedScroll

         static boolean onStartNestedScroll(ViewParent parent, View child, View target, int nestedScrollAxes)

        React to a descendant view initiating a nestable scroll operation, claiming thenested scroll operation if appropriate.

        This version of the method just calls onStartNestedScroll using the touch input type.

        Parameters:
        child - Direct child of this ViewParent containing target
        target - View that initiated the nested scroll
        nestedScrollAxes - Flags consisting of SCROLL_AXIS_HORIZONTAL,SCROLL_AXIS_VERTICAL or both
      • onStopNestedScroll

         static void onStopNestedScroll(ViewParent parent, View target)

        React to a nested scroll operation ending.

        This version of the method just calls onStopNestedScroll using the touch input type.

        Parameters:
        target - View that initiated the nested scroll
      • onNestedScroll

         static 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 using the touch inputtype.

        Parameters:
        target - The descendent view controlling the nested scroll
        dxConsumed - Horizontal scroll distance in pixels already consumed by target
        dyConsumed - Vertical scroll distance in pixels already consumed by target
        dxUnconsumed - Horizontal scroll distance in pixels not consumed by target
        dyUnconsumed - Vertical scroll distance in pixels not consumed by target
      • onNestedScroll

         static 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 viewdispatches a nested scroll event. To receive calls to this method the ViewParent must havepreviously returned true for a call to onStartNestedScroll.

        Both the consumed and unconsumed portions of the scroll distance are reported to theViewParent. An implementation may choose to use the consumed portion to match or chase scrollposition of multiple child elements, for example. The unconsumed portion may be used toallow continuous dragging of multiple scrolling or draggable elements, such as scrollinga list within a vertical drawer where the drawer begins dragging once the edge of innerscrolling content is reached.

        Parameters:
        target - The descendent view controlling the nested scroll
        dxConsumed - Horizontal scroll distance in pixels already consumed by target
        dyConsumed - Vertical scroll distance in pixels already consumed by target
        dxUnconsumed - Horizontal scroll distance in pixels not consumed by target
        dyUnconsumed - Vertical scroll distance in pixels not consumed by target
        type - the type of input which cause this scroll event
      • onNestedPreScroll

         static void onNestedPreScroll(ViewParent parent, View target, int dx, int dy, Array<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 using the touch inputtype.

        Parameters:
        target - View that initiated the nested scroll
        dx - Horizontal scroll distance in pixels
        dy - Vertical scroll distance in pixels
        consumed - Output.
      • onStartNestedScroll

         static boolean onStartNestedScroll(ViewParent parent, View child, View target, int nestedScrollAxes, int type)

        React to a descendant view initiating a nestable scroll operation, claiming thenested scroll operation if appropriate.

        This method will be called in response to a descendant view invoking startNestedScroll. Each parent up the view hierarchy will begiven an opportunity to respond and claim the nested scrolling operation by returningtrue.

        This method may be overridden by ViewParent implementations to indicate when the viewis willing to support a nested scrolling operation that is about to begin. If it returnstrue, this ViewParent will become the target view's nested scrolling parent for the durationof the scroll operation in progress. When the nested scroll is finished this ViewParentwill receive a call to onStopNestedScroll.

        Parameters:
        child - Direct child of this ViewParent containing target
        target - View that initiated the nested scroll
        nestedScrollAxes - Flags consisting of SCROLL_AXIS_HORIZONTAL,SCROLL_AXIS_VERTICAL or both
        type - the type of input which cause this scroll event
      • onNestedScrollAccepted

         static 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 configurationfor the nested scroll. Implementations of this method should always call their superclass'simplementation of this method if one is present.

        Parameters:
        child - Direct child of this ViewParent containing target
        target - View that initiated the nested scroll
        nestedScrollAxes - Flags consisting of SCROLL_AXIS_HORIZONTAL,SCROLL_AXIS_VERTICAL or both
        type - the type of input which cause this scroll event
      • onStopNestedScroll

         static void onStopNestedScroll(ViewParent parent, View target, int type)

        React to a nested scroll operation ending.

        Perform cleanup after a nested scrolling operation.This method will be called when a nested scroll stops, for example when a nested touchscroll ends with a ACTION_UP or ACTION_CANCEL event.Implementations of this method should always call their superclass's implementation of thismethod if one is present.

        Parameters:
        target - View that initiated the nested scroll
        type - the type of input which cause this scroll event
      • onNestedScroll

         static void onNestedScroll(ViewParent parent, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int type, @NonNull() Array<int> consumed)

        React to a nested scroll in progress.

        This method will be called when the ViewParent's current nested scrolling child viewdispatches a nested scroll event. To receive calls to this method the ViewParent must havepreviously returned true for a call to onStartNestedScroll.

        Both the consumed and unconsumed portions of the scroll distance are reported to theViewParent. An implementation may choose to use the consumed portion to match or chase scrollposition of multiple child elements, for example. The unconsumed portion may be used toallow continuous dragging of multiple scrolling or draggable elements, such as scrollinga list within a vertical drawer where the drawer begins dragging once the edge of innerscrolling content is reached.

        Parameters:
        target - The descendent view controlling the nested scroll
        dxConsumed - Horizontal scroll distance in pixels already consumed by target
        dyConsumed - Vertical scroll distance in pixels already consumed by target
        dxUnconsumed - Horizontal scroll distance in pixels not consumed by target
        dyUnconsumed - Vertical scroll distance in pixels not consumed by target
        type - the type of input which cause this scroll event
        consumed - Output.
      • onNestedPreScroll

         static void onNestedPreScroll(ViewParent parent, View target, int dx, int dy, Array<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 opportunityto consume the scroll before the nested scrolling child does. An example of this is adrawer that contains a scrollable list. The user will want to be able to scroll the listfully into view before the list itself begins scrolling.

        onNestedPreScroll is called when a nested scrolling child invokes dispatchNestedPreScroll. The implementationshould report how any pixels of the scroll reported by dx, dy were consumed in theconsumed 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:
        target - View that initiated the nested scroll
        dx - Horizontal scroll distance in pixels
        dy - Vertical scroll distance in pixels
        consumed - Output.
        type - the type of input which cause this scroll event
      • onNestedFling

         static 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 conditionsfor a fling. Generally this means that a touch scroll has ended with a velocity in the direction of scrolling that meets or exceedsthe minimum fling velocity along a scrollable axis.

        If a nested scrolling child view would normally fling but it is at the edge ofits own content, it can use this method to delegate the fling to its nested scrollingparent instead. The parent may optionally consume the fling or observe a child fling.

        Parameters:
        target - View that initiated the nested scroll
        velocityX - Horizontal velocity in pixels per second
        velocityY - Vertical velocity in pixels per second
        consumed - true if the child consumed the fling, false otherwise
      • onNestedPreFling

         static 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 givenvelocity along each axis. Generally this means that a touch scroll has ended with a velocity in the direction of scrolling that meets or exceedsthe minimum fling velocity along a scrollable axis.

        If a nested scrolling parent is consuming motion as part of a pre-scroll, it may beappropriate for it to also consume the pre-fling to complete that same motion. By returningtrue from this method, the parent indicates that the child should notfling its own internal content as well.

        Parameters:
        target - View that initiated the nested scroll
        velocityX - Horizontal velocity in pixels per second
        velocityY - Vertical velocity in pixels per second
      • notifySubtreeAccessibilityStateChanged

         static void notifySubtreeAccessibilityStateChanged(ViewParent parent, View child, View source, int changeType)

        Notifies a view parent that the accessibility state of one of itsdescendants has changed and that the structure of the subtree isdifferent.

        Parameters:
        child - The direct child whose subtree has changed.
        source - The descendant view that changed.
        changeType - A bit mask of the types of changes that occurred.