Package 

Class NestedScrollingParentHelper


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

    • Method Summary

      Modifier and Type Method Description
      void onNestedScrollAccepted(@NonNull() View child, @NonNull() View target, int axes) Called when a nested scrolling operation initiated by a descendant view is acceptedby this ViewGroup.
      void onNestedScrollAccepted(@NonNull() View child, @NonNull() View target, int axes, int type) Called when a nested scrolling operation initiated by a descendant view is acceptedby this ViewGroup.
      int getNestedScrollAxes() Return the current axes of nested scrolling for this ViewGroup.
      void onStopNestedScroll(@NonNull() View target) React to a nested scroll operation ending.
      void onStopNestedScroll(@NonNull() View target, int type) React to a nested scroll operation ending.
      • Methods inherited from class java.lang.Object

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

      • NestedScrollingParentHelper

        NestedScrollingParentHelper(ViewGroup viewGroup)
        Construct a new helper for a given ViewGroup
    • Method Detail

      • onNestedScrollAccepted

         void onNestedScrollAccepted(@NonNull() View child, @NonNull() View target, int axes)

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

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

      • onNestedScrollAccepted

         void onNestedScrollAccepted(@NonNull() View child, @NonNull() View target, int axes, int type)

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

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

      • getNestedScrollAxes

         int getNestedScrollAxes()

        Return the current axes of nested scrolling for this ViewGroup.

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