# CoordinatorLayout.Behavior

Artifact: [androidx.coordinatorlayout:coordinatorlayout](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout) [View Source](https://cs.android.com/search?q=file:androidx/coordinatorlayout/widget/CoordinatorLayout.java+class:androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0)

*** ** * ** ***


```
public abstract class CoordinatorLayout.Behavior<V extends View>
```

<br />

*** ** * ** ***

Interaction behavior plugin for child views of `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout`.

A Behavior implements one or more interactions that a user can take on a child view. These interactions may include drags, swipes, flings, or any other gestures.

| Parameters |
|---|---|
| `<V extends https://developer.android.com/reference/android/view/View.html>` | The View type that this Behavior operates on |

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#Behavior()()` Default constructor for instantiating Behaviors. |
| `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#Behavior(android.content.Context,android.util.AttributeSet)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/util/AttributeSet.html attrs)` Default constructor for inflating Behaviors from layout. |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#blocksInteractionBelow(androidx.coordinatorlayout.widget.CoordinatorLayout,V)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout parent, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child)` Determine whether interaction with views behind the given child in the child order should be blocked. |
| `boolean` | `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#getInsetDodgeRect(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.graphics.Rect)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout parent, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/graphics/Rect.html rect )` Called when a view is set to dodge view insets. |
| `@https://developer.android.com/reference/androidx/annotation/ColorInt int` | `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#getScrimColor(androidx.coordinatorlayout.widget.CoordinatorLayout,V)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout parent, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child)` Supply a scrim color that will be painted behind the associated child view. |
| `@https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0, to = 1) float` | `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#getScrimOpacity(androidx.coordinatorlayout.widget.CoordinatorLayout,V)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout parent, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child)` Determine the current opacity of the scrim behind a given child view |
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/Object.html` | `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#getTag(android.view.View)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html child)` Get the behavior-specific tag object with the given child view. |
| `boolean` | `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#layoutDependsOn(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout parent, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html dependency )` Determine whether the supplied child view has another specific sibling view as a layout dependency. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/view/WindowInsetsCompat` | `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onApplyWindowInsets(androidx.coordinatorlayout.widget.CoordinatorLayout,V,androidx.core.view.WindowInsetsCompat)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout coordinatorLayout, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/view/WindowInsetsCompat insets )` Called when the window insets have changed. |
| `void` | `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onAttachedToLayoutParams(androidx.coordinatorlayout.widget.CoordinatorLayout.LayoutParams)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.LayoutParams params)` Called when the Behavior has been attached to a LayoutParams instance. |
| `boolean` | `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onDependentViewChanged(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout parent, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html dependency )` Respond to a change in a child's dependent view |
| `void` | `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onDependentViewRemoved(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout parent, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html dependency )` Respond to a child's dependent view being removed. |
| `void` | `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onDetachedFromLayoutParams()()` Called when the Behavior has been detached from its holding LayoutParams instance. |
| `boolean` | `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onInterceptTouchEvent(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.MotionEvent)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout parent, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/MotionEvent.html ev )` Respond to CoordinatorLayout touch events before they are dispatched to child views. |
| `boolean` | `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onLayoutChild(androidx.coordinatorlayout.widget.CoordinatorLayout,V,int)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout parent, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child, int layoutDirection )` Called when the parent CoordinatorLayout is about the lay out the given child view. |
| `boolean` | `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onMeasureChild(androidx.coordinatorlayout.widget.CoordinatorLayout,V,int,int,int,int)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout parent, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child, int parentWidthMeasureSpec, int widthUsed, int parentHeightMeasureSpec, int heightUsed )` Called when the parent CoordinatorLayout is about to measure the given child view. |
| `boolean` | `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onNestedFling(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View,float,float,boolean)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout coordinatorLayout, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html target, float velocityX, float velocityY, boolean consumed )` Called when a nested scrolling child is starting a fling or an action that would be a fling. |
| `boolean` | `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onNestedPreFling(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View,float,float)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout coordinatorLayout, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html target, float velocityX, float velocityY )` Called when a nested scrolling child is about to start a fling. |
| `void` | `[onNestedPreScroll](https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onNestedPreScroll(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View,int,int,int[]))( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout coordinatorLayout, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html target, int dx, int dy, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html int[] consumed )` **This method is deprecated.** You should now override `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onNestedPreScroll(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View,int,int,int[],int)`. <br /> |
| `void` | `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onNestedPreScroll(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View,int,int,int[],int)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout coordinatorLayout, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html target, int dx, int dy, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html int[] consumed, int type )` Called when a nested scroll in progress is about to update, before the target has consumed any of the scrolled distance. |
| `void` | `[onNestedScroll](https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onNestedScroll(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View,int,int,int,int))( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout coordinatorLayout, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed )` **This method is deprecated.** You should now override `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onNestedScroll(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View,int,int,int,int,int,int[])`. <br /> |
| `void` | `[onNestedScroll](https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onNestedScroll(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View,int,int,int,int,int))( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout coordinatorLayout, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int type )` **This method is deprecated.** You should now override `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onNestedScroll(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View,int,int,int,int,int,int[])`. <br /> |
| `void` | `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onNestedScroll(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View,int,int,int,int,int,int[])( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout coordinatorLayout, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int type, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html int[] consumed )` Called when a nested scroll in progress has updated and the target has scrolled or attempted to scroll. |
| `void` | `[onNestedScrollAccepted](https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onNestedScrollAccepted(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View,android.view.View,int))( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout coordinatorLayout, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html directTargetChild, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html target, int axes )` **This method is deprecated.** You should now override `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onNestedScrollAccepted(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View,android.view.View,int,int)`. <br /> |
| `void` | `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onNestedScrollAccepted(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View,android.view.View,int,int)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout coordinatorLayout, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html directTargetChild, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html target, int axes, int type )` Called when a nested scroll has been accepted by the CoordinatorLayout. |
| `boolean` | `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onRequestChildRectangleOnScreen(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.graphics.Rect,boolean)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout coordinatorLayout, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/graphics/Rect.html rectangle, boolean immediate )` Called when a child of the view associated with this behavior wants a particular rectangle to be positioned onto the screen. |
| `boolean` | `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onRequestChildRectangleOnScreen(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.graphics.Rect,boolean,int)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout coordinatorLayout, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/graphics/Rect.html rectangle, boolean immediate, int source )` Called when a child of the view associated with this behavior wants a particular rectangle to be positioned onto the screen, with the source of the request. |
| `void` | `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onRestoreInstanceState(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.os.Parcelable)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout parent, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/os/Parcelable.html state )` Hook allowing a behavior to re-apply a representation of its internal state that had previously been generated by `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onSaveInstanceState(androidx.coordinatorlayout.widget.CoordinatorLayout,V)`. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Parcelable.html` | `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onSaveInstanceState(androidx.coordinatorlayout.widget.CoordinatorLayout,V)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout parent, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child)` Hook allowing a behavior to generate a representation of its internal state that can later be used to create a new instance with that same state. |
| `boolean` | `[onStartNestedScroll](https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onStartNestedScroll(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View,android.view.View,int))( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout coordinatorLayout, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html directTargetChild, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html target, int axes )` **This method is deprecated.** You should now override `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onStartNestedScroll(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View,android.view.View,int,int)`. <br /> |
| `boolean` | `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onStartNestedScroll(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View,android.view.View,int,int)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout coordinatorLayout, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html directTargetChild, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html target, int axes, int type )` Called when a descendant of the CoordinatorLayout attempts to initiate a nested scroll. |
| `void` | `[onStopNestedScroll](https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onStopNestedScroll(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View))( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout coordinatorLayout, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html target )` **This method is deprecated.** You should now override `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onStopNestedScroll(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View,int)`. <br /> |
| `void` | `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onStopNestedScroll(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View,int)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout coordinatorLayout, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html target, int type )` Called when a nested scroll has ended. |
| `boolean` | `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onTouchEvent(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.MotionEvent)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout parent, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/MotionEvent.html ev )` Respond to CoordinatorLayout touch events after this Behavior has started `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onInterceptTouchEvent(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.MotionEvent)` them. |
| `static void` | `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#setTag(android.view.View,java.lang.Object)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html child, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/Object.html tag)` Associate a Behavior-specific tag object with the given child view. |

## Public constructors

### Behavior

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0)

```
public Behavior()
```

Default constructor for instantiating Behaviors.

### Behavior

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0)

```
public Behavior(@NonNull Context context, @Nullable AttributeSet attrs)
```

Default constructor for inflating Behaviors from layout. The Behavior will have the opportunity to parse specially defined layout parameters. These parameters will appear on the child view tag.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context` |   |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/util/AttributeSet.html attrs` |   |

## Public methods

### blocksInteractionBelow

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0)

```
public boolean blocksInteractionBelow(@NonNull CoordinatorLayout parent, @NonNull V child)
```

Determine whether interaction with views behind the given child in the child order should be blocked.

The default implementation returns true if `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#getScrimOpacity(androidx.coordinatorlayout.widget.CoordinatorLayout,V)` would return \>0.0f.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout parent` | the parent view of the given child |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child` | the child view to test |

| Returns |
|---|---|
| `boolean` | true if `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#getScrimOpacity(androidx.coordinatorlayout.widget.CoordinatorLayout,V)` would return \>0.0f. |

### getInsetDodgeRect

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0)

```
public boolean getInsetDodgeRect(
    @NonNull CoordinatorLayout parent,
    @NonNull V child,
    @NonNull Rect rect
)
```

Called when a view is set to dodge view insets.

This method allows a behavior to update the rectangle that should be dodged. The rectangle should be in the parent's coordinate system and within the child's bounds. If not, a `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` is thrown.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout parent` | the CoordinatorLayout parent of the view this Behavior is associated with |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child` | the child view of the CoordinatorLayout this Behavior is associated with |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/graphics/Rect.html rect` | the rect to update with the dodge rectangle |

| Returns |
|---|---|
| `boolean` | true the rect was updated, false if we should use the child's bounds |

### getScrimColor

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0)

```
public @ColorInt int getScrimColor(@NonNull CoordinatorLayout parent, @NonNull V child)
```

Supply a scrim color that will be painted behind the associated child view.

A scrim may be used to indicate that the other elements beneath it are not currently interactive or actionable, drawing user focus and attention to the views above the scrim.

The default implementation returns `https://developer.android.com/reference/android/graphics/Color.html#BLACK`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout parent` | the parent view of the given child |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child` | the child view above the scrim |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/ColorInt int` | the desired scrim color in 0xAARRGGBB format. The default return value is `https://developer.android.com/reference/android/graphics/Color.html#BLACK`. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#getScrimOpacity(androidx.coordinatorlayout.widget.CoordinatorLayout,V)` |   |

### getScrimOpacity

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0)

```
public @FloatRange(from = 0, to = 1) float getScrimOpacity(@NonNull CoordinatorLayout parent, @NonNull V child)
```

Determine the current opacity of the scrim behind a given child view

A scrim may be used to indicate that the other elements beneath it are not currently interactive or actionable, drawing user focus and attention to the views above the scrim.

The default implementation returns 0.0f.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout parent` | the parent view of the given child |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child` | the child view above the scrim |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0, to = 1) float` | the desired scrim opacity from 0.0f to 1.0f. The default return value is 0.0f. |

### getTag

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0)

```
public static @Nullable Object getTag(@NonNull View child)
```

Get the behavior-specific tag object with the given child view. This object is stored with the child view's LayoutParams.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html child` | child view to get tag with |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/Object.html` | the previously stored tag object |

### layoutDependsOn

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0)

```
public boolean layoutDependsOn(
    @NonNull CoordinatorLayout parent,
    @NonNull V child,
    @NonNull View dependency
)
```

Determine whether the supplied child view has another specific sibling view as a layout dependency.

This method will be called at least once in response to a layout request. If it returns true for a given child and dependency view pair, the parent CoordinatorLayout will:

1. Always lay out this child after the dependent child is laid out, regardless of child order.
2. Call `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onDependentViewChanged(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View)` when the dependency view's layout or position changes.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout parent` | the parent view of the given child |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child` | the child view to test |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html dependency` | the proposed dependency of child |

| Returns |
|---|---|
| `boolean` | true if child's layout depends on the proposed dependency's layout, false otherwise |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onDependentViewChanged(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View)` |   |

### onApplyWindowInsets

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0)

```
public @NonNull WindowInsetsCompat onApplyWindowInsets(
    @NonNull CoordinatorLayout coordinatorLayout,
    @NonNull V child,
    @NonNull WindowInsetsCompat insets
)
```

Called when the window insets have changed.

Any Behavior associated with the direct child of the CoordinatorLayout may elect to handle the window inset change on behalf of it's associated view.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout coordinatorLayout` | the CoordinatorLayout parent of the view this Behavior is associated with |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child` | the child view of the CoordinatorLayout this Behavior is associated with |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/view/WindowInsetsCompat insets` | the new window insets. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/view/WindowInsetsCompat` | The insets supplied, minus any insets that were consumed |

### onAttachedToLayoutParams

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0)

```
public void onAttachedToLayoutParams(@NonNull CoordinatorLayout.LayoutParams params)
```

Called when the Behavior has been attached to a LayoutParams instance.

This will be called after the LayoutParams has been instantiated and can be modified.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.LayoutParams params` | the LayoutParams instance that this Behavior has been attached to |

### onDependentViewChanged

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0)

```
public boolean onDependentViewChanged(
    @NonNull CoordinatorLayout parent,
    @NonNull V child,
    @NonNull View dependency
)
```

Respond to a change in a child's dependent view

This method is called whenever a dependent view changes in size or position outside of the standard layout flow. A Behavior may use this method to appropriately update the child view in response.

A view's dependency is determined by `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#layoutDependsOn(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View)` or if `child` has set another view as it's anchor.

Note that if a Behavior changes the layout of a child via this method, it should also be able to reconstruct the correct position in `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onLayoutChild(androidx.coordinatorlayout.widget.CoordinatorLayout,V,int)`. `onDependentViewChanged` will not be called during normal layout since the layout of each child view will always happen in dependency order.

If the Behavior changes the child view's size or position, it should return true. The default implementation returns false.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout parent` | the parent view of the given child |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child` | the child view to manipulate |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html dependency` | the dependent view that changed |

| Returns |
|---|---|
| `boolean` | true if the Behavior changed the child view's size or position, false otherwise |

### onDependentViewRemoved

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0)

```
public void onDependentViewRemoved(
    @NonNull CoordinatorLayout parent,
    @NonNull V child,
    @NonNull View dependency
)
```

Respond to a child's dependent view being removed.

This method is called after a dependent view has been removed from the parent. A Behavior may use this method to appropriately update the child view in response.

A view's dependency is determined by `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#layoutDependsOn(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View)` or if `child` has set another view as it's anchor.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout parent` | the parent view of the given child |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child` | the child view to manipulate |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html dependency` | the dependent view that has been removed |

### onDetachedFromLayoutParams

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0)

```
public void onDetachedFromLayoutParams()
```

Called when the Behavior has been detached from its holding LayoutParams instance.

This will only be called if the Behavior has been explicitly removed from the LayoutParams instance via `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.LayoutParams#setBehavior(androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior)`. It will not be called if the associated view is removed from the CoordinatorLayout or similar.

### onInterceptTouchEvent

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0)

```
public boolean onInterceptTouchEvent(
    @NonNull CoordinatorLayout parent,
    @NonNull V child,
    @NonNull MotionEvent ev
)
```

Respond to CoordinatorLayout touch events before they are dispatched to child views.

Behaviors can use this to monitor inbound touch events until one decides to intercept the rest of the event stream to take an action on its associated child view. This method will return false until it detects the proper intercept conditions, then return true once those conditions have occurred.

Once a Behavior intercepts touch events, the rest of the event stream will be sent to the `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onTouchEvent(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.MotionEvent)` method.

This method will be called regardless of the visibility of the associated child of the behavior. If you only wish to handle touch events when the child is visible, you should add a check to `https://developer.android.com/reference/android/view/View.html#isShown()` on the given child.

The default implementation of this method always returns false.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout parent` | the parent view currently receiving this touch event |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child` | the child view associated with this Behavior |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/MotionEvent.html ev` | the MotionEvent describing the touch event being processed |

| Returns |
|---|---|
| `boolean` | true if this Behavior would like to intercept and take over the event stream. The default always returns false. |

### onLayoutChild

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0)

```
public boolean onLayoutChild(
    @NonNull CoordinatorLayout parent,
    @NonNull V child,
    int layoutDirection
)
```

Called when the parent CoordinatorLayout is about the lay out the given child view.

This method can be used to perform custom or modified layout of a child view in place of the default child layout behavior. The Behavior's implementation can delegate to the standard CoordinatorLayout measurement behavior by calling `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout#onLayoutChild(android.view.View,int)`.

If a Behavior implements `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onDependentViewChanged(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View)` to change the position of a view in response to a dependent view changing, it should also implement `onLayoutChild` in such a way that respects those dependent views. `onLayoutChild` will always be called for a dependent view *after* its dependency has been laid out.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout parent` | the parent CoordinatorLayout |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child` | child view to lay out |
| `int layoutDirection` | the resolved layout direction for the CoordinatorLayout, such as `https://developer.android.com/reference/androidx/core/view/ViewCompat#LAYOUT_DIRECTION_LTR()` or `https://developer.android.com/reference/androidx/core/view/ViewCompat#LAYOUT_DIRECTION_RTL()`. |

| Returns |
|---|---|
| `boolean` | true if the Behavior performed layout of the child view, false to request default layout behavior |

### onMeasureChild

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0)

```
public boolean onMeasureChild(
    @NonNull CoordinatorLayout parent,
    @NonNull V child,
    int parentWidthMeasureSpec,
    int widthUsed,
    int parentHeightMeasureSpec,
    int heightUsed
)
```

Called when the parent CoordinatorLayout is about to measure the given child view.

This method can be used to perform custom or modified measurement of a child view in place of the default child measurement behavior. The Behavior's implementation can delegate to the standard CoordinatorLayout measurement behavior by calling `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout#onMeasureChild(android.view.View,int,int,int,int)`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout parent` | the parent CoordinatorLayout |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child` | the child to measure |
| `int parentWidthMeasureSpec` | the width requirements for this view |
| `int widthUsed` | extra space that has been used up by the parent horizontally (possibly by other children of the parent) |
| `int parentHeightMeasureSpec` | the height requirements for this view |
| `int heightUsed` | extra space that has been used up by the parent vertically (possibly by other children of the parent) |

| Returns |
|---|---|
| `boolean` | true if the Behavior measured the child view, false if the CoordinatorLayout should perform its default measurement |

### onNestedFling

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0)

```
public boolean onNestedFling(
    @NonNull CoordinatorLayout coordinatorLayout,
    @NonNull V child,
    @NonNull View target,
    float velocityX,
    float velocityY,
    boolean consumed
)
```

Called when a nested scrolling child is starting a fling or an action that would be a fling.

Any Behavior associated with the direct child of the CoordinatorLayout may elect to accept the nested scroll as part of `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onStartNestedScroll(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View,android.view.View,int)`. Each Behavior that returned true will receive subsequent nested scroll events for that nested scroll.

`onNestedFling` is called when the current nested scrolling child view detects the proper conditions for a fling. It reports if the child itself consumed the fling. If it did not, the child is expected to show some sort of overscroll indication. This method should return true if it consumes the fling, so that a child that did not itself take an action in response can choose not to show an overfling indication.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout coordinatorLayout` | the CoordinatorLayout parent of the view this Behavior is associated with |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child` | the child view of the CoordinatorLayout this Behavior is associated with |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html target` | the descendant view of the CoordinatorLayout performing the nested scroll |
| `float velocityX` | horizontal velocity of the attempted fling |
| `float velocityY` | vertical velocity of the attempted fling |
| `boolean consumed` | true if the nested child view consumed the fling |

| Returns |
|---|---|
| `boolean` | true if the Behavior consumed the fling |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/core/view/NestedScrollingParent#onNestedFling(android.view.View,float,float,boolean)` |   |

### onNestedPreFling

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0)

```
public boolean onNestedPreFling(
    @NonNull CoordinatorLayout coordinatorLayout,
    @NonNull V child,
    @NonNull View target,
    float velocityX,
    float velocityY
)
```

Called when a nested scrolling child is about to start a fling.

Any Behavior associated with the direct child of the CoordinatorLayout may elect to accept the nested scroll as part of `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onStartNestedScroll(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View,android.view.View,int)`. Each Behavior that returned true will receive subsequent nested scroll events for that nested scroll.

`onNestedPreFling` is called when the current nested scrolling child view detects the proper conditions for a fling, but it has not acted on it yet. A Behavior can return true to indicate that it consumed the fling. If at least one Behavior returns true, the fling should not be acted upon by the child.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout coordinatorLayout` | the CoordinatorLayout parent of the view this Behavior is associated with |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child` | the child view of the CoordinatorLayout this Behavior is associated with |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html target` | the descendant view of the CoordinatorLayout performing the nested scroll |
| `float velocityX` | horizontal velocity of the attempted fling |
| `float velocityY` | vertical velocity of the attempted fling |

| Returns |
|---|---|
| `boolean` | true if the Behavior consumed the fling |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/core/view/NestedScrollingParent#onNestedPreFling(android.view.View,float,float)` |   |

### onNestedPreScroll

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0)

```
public void [onNestedPreScroll](https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onNestedPreScroll(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View,int,int,int[]))(
    @NonNull CoordinatorLayout coordinatorLayout,
    @NonNull V child,
    @NonNull View target,
    int dx,
    int dy,
    @NonNull int[] consumed
)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> You should now override `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onNestedPreScroll(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View,int,int,int[],int)`. This method will still continue to be called if the type is `https://developer.android.com/reference/androidx/core/view/ViewCompat#TYPE_TOUCH()`.

### onNestedPreScroll

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0)

```
public void onNestedPreScroll(
    @NonNull CoordinatorLayout coordinatorLayout,
    @NonNull V child,
    @NonNull View target,
    int dx,
    int dy,
    @NonNull int[] consumed,
    int type
)
```

Called when a nested scroll in progress is about to update, before the target has consumed any of the scrolled distance.

Any Behavior associated with the direct child of the CoordinatorLayout may elect to accept the nested scroll as part of `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onStartNestedScroll(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View,android.view.View,int)`. Each Behavior that returned true will receive subsequent nested scroll events for that nested scroll.

`onNestedPreScroll` is called each time the nested scroll is updated by the nested scrolling child, before the nested scrolling child has consumed the scroll distance itself. *Each Behavior responding to the nested scroll will receive the same values.* The CoordinatorLayout will report as consumed the maximum number of pixels in either direction that any Behavior responding to the nested scroll reported as consumed.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout coordinatorLayout` | the CoordinatorLayout parent of the view this Behavior is associated with |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child` | the child view of the CoordinatorLayout this Behavior is associated with |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html target` | the descendant view of the CoordinatorLayout performing the nested scroll |
| `int dx` | the raw horizontal number of pixels that the user attempted to scroll |
| `int dy` | the raw vertical number of pixels that the user attempted to scroll |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html int[] consumed` | out parameter. consumed\[0\] should be set to the distance of dx that was consumed, consumed\[1\] should be set to the distance of dy that was consumed |
| `int type` | the type of input which cause this scroll event |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/core/view/NestedScrollingParent2#onNestedPreScroll(android.view.View,int,int,int[],int)` |   |

### onNestedScroll

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0)

```
public void [onNestedScroll](https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onNestedScroll(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View,int,int,int,int))(
    @NonNull CoordinatorLayout coordinatorLayout,
    @NonNull V child,
    @NonNull View target,
    int dxConsumed,
    int dyConsumed,
    int dxUnconsumed,
    int dyUnconsumed
)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> You should now override `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onNestedScroll(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View,int,int,int,int,int,int[])`. This method will still continue to be called if neither `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onNestedScroll(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View,int,int,int,int,int,int[])` nor `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout#onNestedScroll(android.view.View,int,int,int,int,int)` are overridden and the type is `https://developer.android.com/reference/androidx/core/view/ViewCompat#TYPE_TOUCH()`.

### onNestedScroll

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0)

```
public void [onNestedScroll](https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onNestedScroll(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View,int,int,int,int,int))(
    @NonNull CoordinatorLayout coordinatorLayout,
    @NonNull V child,
    @NonNull View target,
    int dxConsumed,
    int dyConsumed,
    int dxUnconsumed,
    int dyUnconsumed,
    int type
)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> You should now override `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onNestedScroll(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View,int,int,int,int,int,int[])`. This method will still continue to be called if `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onNestedScroll(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View,int,int,int,int,int,int[])` is not overridden.

### onNestedScroll

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0)

```
public void onNestedScroll(
    @NonNull CoordinatorLayout coordinatorLayout,
    @NonNull V child,
    @NonNull View target,
    int dxConsumed,
    int dyConsumed,
    int dxUnconsumed,
    int dyUnconsumed,
    int type,
    @NonNull int[] consumed
)
```

Called when a nested scroll in progress has updated and the target has scrolled or attempted to scroll.

Any Behavior associated with the direct child of the CoordinatorLayout may elect to accept the nested scroll as part of `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onStartNestedScroll(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View,android.view.View,int)`. Each Behavior that returned true will receive subsequent nested scroll events for that nested scroll.

`onNestedScroll` is called each time the nested scroll is updated by the nested scrolling child, with both consumed and unconsumed components of the scroll supplied in pixels. *Each Behavior responding to the nested scroll will receive the same values.*

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout coordinatorLayout` | the CoordinatorLayout parent of the view this Behavior is associated with |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child` | the child view of the CoordinatorLayout this Behavior is associated with |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html target` | the descendant view of the CoordinatorLayout performing the nested scroll |
| `int dxConsumed` | horizontal pixels consumed by the target's own scrolling operation |
| `int dyConsumed` | vertical pixels consumed by the target's own scrolling operation |
| `int dxUnconsumed` | horizontal pixels not consumed by the target's own scrolling operation, but requested by the user |
| `int dyUnconsumed` | vertical pixels not consumed by the target's own scrolling operation, but requested by the user |
| `int type` | the type of input which cause this scroll event |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html int[] consumed` | output. Upon this method returning, should contain the scroll distances consumed by this Behavior |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/core/view/NestedScrollingParent3#onNestedScroll(android.view.View,int,int,int,int,int,int[])` |   |

### onNestedScrollAccepted

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0)

```
public void [onNestedScrollAccepted](https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onNestedScrollAccepted(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View,android.view.View,int))(
    @NonNull CoordinatorLayout coordinatorLayout,
    @NonNull V child,
    @NonNull View directTargetChild,
    @NonNull View target,
    int axes
)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> You should now override `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onNestedScrollAccepted(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View,android.view.View,int,int)`. This method will still continue to be called if the type is `https://developer.android.com/reference/androidx/core/view/ViewCompat#TYPE_TOUCH()`.

### onNestedScrollAccepted

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0)

```
public void onNestedScrollAccepted(
    @NonNull CoordinatorLayout coordinatorLayout,
    @NonNull V child,
    @NonNull View directTargetChild,
    @NonNull View target,
    int axes,
    int type
)
```

Called when a nested scroll has been accepted by the CoordinatorLayout.

Any Behavior associated with any direct child of the CoordinatorLayout may elect to accept the nested scroll as part of `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onStartNestedScroll(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View,android.view.View,int)`. Each Behavior that returned true will receive subsequent nested scroll events for that nested scroll.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout coordinatorLayout` | the CoordinatorLayout parent of the view this Behavior is associated with |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child` | the child view of the CoordinatorLayout this Behavior is associated with |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html directTargetChild` | the child view of the CoordinatorLayout that either is or contains the target of the nested scroll operation |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html target` | the descendant view of the CoordinatorLayout initiating the nested scroll |
| `int axes` | the axes that this nested scroll applies to. See `https://developer.android.com/reference/androidx/core/view/ViewCompat#SCROLL_AXIS_HORIZONTAL()`, `https://developer.android.com/reference/androidx/core/view/ViewCompat#SCROLL_AXIS_VERTICAL()` |
| `int type` | the type of input which cause this scroll event |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/core/view/NestedScrollingParent2#onNestedScrollAccepted(android.view.View,android.view.View,int,int)` |   |

### onRequestChildRectangleOnScreen

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0)

```
public boolean onRequestChildRectangleOnScreen(
    @NonNull CoordinatorLayout coordinatorLayout,
    @NonNull V child,
    @NonNull Rect rectangle,
    boolean immediate
)
```

Called when a child of the view associated with this behavior wants a particular rectangle to be positioned onto the screen.

The contract for this method is the same as `https://developer.android.com/reference/android/view/ViewParent.html#requestChildRectangleOnScreen(android.view.View, android.graphics.Rect, boolean)`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout coordinatorLayout` | the CoordinatorLayout parent of the view this Behavior is associated with |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child` | the child view of the CoordinatorLayout this Behavior is associated with |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/graphics/Rect.html rectangle` | The rectangle which the child wishes to be on the screen in the child's coordinates |
| `boolean immediate` | true to forbid animated or delayed scrolling, false otherwise |

| Returns |
|---|---|
| `boolean` | true if the Behavior handled the request |

| See also |
|---|---|
| `https://developer.android.com/reference/android/view/ViewParent.html#requestChildRectangleOnScreen(android.view.View, android.graphics.Rect, boolean)` |   |
| `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onRequestChildRectangleOnScreen(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.graphics.Rect,boolean,int)` |   |

### onRequestChildRectangleOnScreen

Added in [1.4.0-alpha01](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.4.0-alpha01)

```
public boolean onRequestChildRectangleOnScreen(
    @NonNull CoordinatorLayout coordinatorLayout,
    @NonNull V child,
    @NonNull Rect rectangle,
    boolean immediate,
    int source
)
```

Called when a child of the view associated with this behavior wants a particular rectangle to be positioned onto the screen, with the source of the request.

The contract for this method is the same as `ViewParent#requestChildRectangleOnScreen(View, Rect, boolean, int)`, which was added in API 36.1. Starting with API 36.1, the platform passes the source of the request, for example `View.RECTANGLE_ON_SCREEN_REQUEST_SOURCE_INPUT_FOCUS` when a view gains focus.

The default implementation calls `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onRequestChildRectangleOnScreen(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.graphics.Rect,boolean)`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout coordinatorLayout` | the CoordinatorLayout parent of the view this Behavior is associated with |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child` | the child view of the CoordinatorLayout this Behavior is associated with |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/graphics/Rect.html rectangle` | The rectangle which the child wishes to be on the screen in the child's coordinates |
| `boolean immediate` | true to forbid animated or delayed scrolling, false otherwise |
| `int source` | the source of the request, one of the `View.RECTANGLE_ON_SCREEN_REQUEST_SOURCE_*` constants. It's `View.RECTANGLE_ON_SCREEN_REQUEST_SOURCE_UNDEFINED` (0) before API 36.1, or when the request comes through `https://developer.android.com/reference/android/view/ViewParent.html#requestChildRectangleOnScreen(android.view.View, android.graphics.Rect, boolean)`. Value is one of the following: - `View.RECTANGLE_ON_SCREEN_REQUEST_SOURCE_UNDEFINED` - `View.RECTANGLE_ON_SCREEN_REQUEST_SOURCE_SCROLL_ONLY` - `View.RECTANGLE_ON_SCREEN_REQUEST_SOURCE_TEXT_CURSOR` - `View.RECTANGLE_ON_SCREEN_REQUEST_SOURCE_INPUT_FOCUS` <br /> |

| Returns |
|---|---|
| `boolean` | true if the Behavior handled the request |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onRequestChildRectangleOnScreen(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.graphics.Rect,boolean)` |   |

### onRestoreInstanceState

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0)

```
public void onRestoreInstanceState(
    @NonNull CoordinatorLayout parent,
    @NonNull V child,
    @NonNull Parcelable state
)
```

Hook allowing a behavior to re-apply a representation of its internal state that had previously been generated by `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onSaveInstanceState(androidx.coordinatorlayout.widget.CoordinatorLayout,V)`. This function will never be called with a null state.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout parent` | the parent CoordinatorLayout |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child` | child view to restore from |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/os/Parcelable.html state` | The frozen state that had previously been returned by `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onSaveInstanceState(androidx.coordinatorlayout.widget.CoordinatorLayout,V)`. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout#onSaveInstanceState()` |   |

### onSaveInstanceState

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0)

```
public @Nullable Parcelable onSaveInstanceState(@NonNull CoordinatorLayout parent, @NonNull V child)
```

Hook allowing a behavior to generate a representation of its internal state that can later be used to create a new instance with that same state. This state should only contain information that is not persistent or can not be reconstructed later.

Behavior state is only saved when both the parent `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout` and a view using this behavior have valid IDs set.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout parent` | the parent CoordinatorLayout |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child` | child view to restore from |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Parcelable.html` | Returns a Parcelable object containing the behavior's current dynamic state. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout#onRestoreInstanceState(android.os.Parcelable)` |   |
| `https://developer.android.com/reference/android/view/View.html#onSaveInstanceState()` |   |

### onStartNestedScroll

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0)

```
public boolean [onStartNestedScroll](https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onStartNestedScroll(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View,android.view.View,int))(
    @NonNull CoordinatorLayout coordinatorLayout,
    @NonNull V child,
    @NonNull View directTargetChild,
    @NonNull View target,
    int axes
)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> You should now override `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onStartNestedScroll(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View,android.view.View,int,int)`. This method will still continue to be called if the type is `https://developer.android.com/reference/androidx/core/view/ViewCompat#TYPE_TOUCH()`.

### onStartNestedScroll

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0)

```
public boolean onStartNestedScroll(
    @NonNull CoordinatorLayout coordinatorLayout,
    @NonNull V child,
    @NonNull View directTargetChild,
    @NonNull View target,
    int axes,
    int type
)
```

Called when a descendant of the CoordinatorLayout attempts to initiate a nested scroll.

Any Behavior associated with any direct child of the CoordinatorLayout may respond to this event and return true to indicate that the CoordinatorLayout should act as a nested scrolling parent for this scroll. Only Behaviors that return true from this method will receive subsequent nested scroll events.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout coordinatorLayout` | the CoordinatorLayout parent of the view this Behavior is associated with |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child` | the child view of the CoordinatorLayout this Behavior is associated with |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html directTargetChild` | the child view of the CoordinatorLayout that either is or contains the target of the nested scroll operation |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html target` | the descendant view of the CoordinatorLayout initiating the nested scroll |
| `int axes` | the axes that this nested scroll applies to. See `https://developer.android.com/reference/androidx/core/view/ViewCompat#SCROLL_AXIS_HORIZONTAL()`, `https://developer.android.com/reference/androidx/core/view/ViewCompat#SCROLL_AXIS_VERTICAL()` |
| `int type` | the type of input which cause this scroll event |

| Returns |
|---|---|
| `boolean` | true if the Behavior wishes to accept this nested scroll |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/core/view/NestedScrollingParent2#onStartNestedScroll(android.view.View,android.view.View,int,int)` |   |

### onStopNestedScroll

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0)

```
public void [onStopNestedScroll](https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onStopNestedScroll(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View))(
    @NonNull CoordinatorLayout coordinatorLayout,
    @NonNull V child,
    @NonNull View target
)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> You should now override `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onStopNestedScroll(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View,int)`. This method will still continue to be called if the type is `https://developer.android.com/reference/androidx/core/view/ViewCompat#TYPE_TOUCH()`.

### onStopNestedScroll

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0)

```
public void onStopNestedScroll(
    @NonNull CoordinatorLayout coordinatorLayout,
    @NonNull V child,
    @NonNull View target,
    int type
)
```

Called when a nested scroll has ended.

Any Behavior associated with any direct child of the CoordinatorLayout may elect to accept the nested scroll as part of `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onStartNestedScroll(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.View,android.view.View,int)`. Each Behavior that returned true will receive subsequent nested scroll events for that nested scroll.

`onStopNestedScroll` marks the end of a single nested scroll event sequence. This is a good place to clean up any state related to the nested scroll.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout coordinatorLayout` | the CoordinatorLayout parent of the view this Behavior is associated with |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child` | the child view of the CoordinatorLayout this Behavior is associated with |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html target` | the descendant view of the CoordinatorLayout that initiated the nested scroll |
| `int type` | the type of input which cause this scroll event |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/core/view/NestedScrollingParent2#onStopNestedScroll(android.view.View,int)` |   |

### onTouchEvent

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0)

```
public boolean onTouchEvent(
    @NonNull CoordinatorLayout parent,
    @NonNull V child,
    @NonNull MotionEvent ev
)
```

Respond to CoordinatorLayout touch events after this Behavior has started `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#onInterceptTouchEvent(androidx.coordinatorlayout.widget.CoordinatorLayout,V,android.view.MotionEvent)` them.

Behaviors may intercept touch events in order to help the CoordinatorLayout manipulate its child views. For example, a Behavior may allow a user to drag a UI pane open or closed. This method should perform actual mutations of view layout state.

This method will be called regardless of the visibility of the associated child of the behavior. If you only wish to handle touch events when the child is visible, you should add a check to `https://developer.android.com/reference/android/view/View.html#isShown()` on the given child.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout parent` | the parent view currently receiving this touch event |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html V child` | the child view associated with this Behavior |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/MotionEvent.html ev` | the MotionEvent describing the touch event being processed |

| Returns |
|---|---|
| `boolean` | true if this Behavior handled this touch event and would like to continue receiving events in this stream. The default always returns false. |

### setTag

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0)

```
public static void setTag(@NonNull View child, @Nullable Object tag)
```

Associate a Behavior-specific tag object with the given child view. This object will be stored with the child view's LayoutParams.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html child` | child view to set tag with |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/Object.html tag` | tag object to set |