# BottomSheetBehavior

added in[version 23.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  
belongs to Maven artifact com.android.support:design:27.1.0  
Summary:[Nested Classes](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#nestedclasses)\|[XML Attrs](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#lattrs)\|[Constants](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#constants)\|[Ctors](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#pubctors)\|[Methods](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#)  

# BottomSheetBehavior

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The support library has been superseded by[AndroidX](https://developer.android.com/jetpack/androidx)which is part of[Jetpack](https://developer.android.com/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider[migrating](https://developer.android.com/jetpack/androidx/migrate)existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library[class mappings](https://developer.android.com/jetpack/androidx/migrate/class-mappings).

`
public


class
BottomSheetBehavior
`  
`


``

extends `[Behavior](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior)`<V extends `[View](https://developer.android.com/reference/android/view/View.html)`>


``


`

|---|---|---------------------------------------------------------------------------------------------------------------------------------------------------|
| java.lang.Object                                                                                                                                        |||
| ↳ | [android.support.design.widget.CoordinatorLayout.Behavior](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior)\<V extends[android.view.View](https://developer.android.com/reference/android/view/View.html)\> ||
|   | ↳ | android.support.design.widget.BottomSheetBehavior\<V extends[android.view.View](https://developer.android.com/reference/android/view/View.html)\> |

<br />

*** ** * ** ***

An interaction behavior plugin for a child view of[CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout)to make it work as a bottom sheet.

## Summary

|                                                                                                   ### Nested classes                                                                                                   ||
|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` class` | [BottomSheetBehavior.BottomSheetCallback](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior.BottomSheetCallback) Callback for monitoring events about bottom sheets. |
| ` class` | [BottomSheetBehavior.SavedState](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior.SavedState) <br />                                                                |

|                                                                                             ### XML attributes                                                                                             ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [`BottomSheetBehavior_Layout_behavior_hideable`](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#attr_BottomSheetBehavior_Layout_behavior_hideable)           |   |
| [`BottomSheetBehavior_Layout_behavior_peekHeight`](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#attr_BottomSheetBehavior_Layout_behavior_peekHeight)       |   |
| [`BottomSheetBehavior_Layout_behavior_skipCollapsed`](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#attr_BottomSheetBehavior_Layout_behavior_skipCollapsed) |   |

|                                                                                    ### Constants                                                                                    ||
|-------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | [PEEK_HEIGHT_AUTO](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#PEEK_HEIGHT_AUTO) Peek at the 16:9 ratio keyline of its parent. |
| `int` | [STATE_COLLAPSED](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#STATE_COLLAPSED) The bottom sheet is collapsed.                  |
| `int` | [STATE_DRAGGING](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#STATE_DRAGGING) The bottom sheet is dragging.                     |
| `int` | [STATE_EXPANDED](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#STATE_EXPANDED) The bottom sheet is expanded.                     |
| `int` | [STATE_HIDDEN](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#STATE_HIDDEN) The bottom sheet is hidden.                           |
| `int` | [STATE_SETTLING](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#STATE_SETTLING) The bottom sheet is settling.                     |

|                                                                                                                                                                                                                     ### Public constructors                                                                                                                                                                                                                      ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[BottomSheetBehavior](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#BottomSheetBehavior())`() ` Default constructor for instantiating BottomSheetBehaviors.                                                                                                                                                                                                                                                    |
| ` `[BottomSheetBehavior](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#BottomSheetBehavior(android.content.Context, android.util.AttributeSet))`(`[Context](https://developer.android.com/reference/android/content/Context.html)` context, `[AttributeSet](https://developer.android.com/reference/android/util/AttributeSet.html)` attrs) ` Default constructor for inflating BottomSheetBehaviors from layout. |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ### Public methods                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` static <V extends `[View](https://developer.android.com/reference/android/view/View.html)`> `[BottomSheetBehavior](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior)`<V>` | ` `[from](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#from(V))`(V view) ` A utility function to get the[BottomSheetBehavior](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior)associated with the`view`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ` final int`                                                                                                                                                                                                         | ` `[getPeekHeight](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#getPeekHeight())`() ` Gets the height of the bottom sheet when it is collapsed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| ` boolean`                                                                                                                                                                                                           | ` `[getSkipCollapsed](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#getSkipCollapsed())`() ` Sets whether this bottom sheet should skip the collapsed state when it is being hidden after it is expanded once.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ` final int`                                                                                                                                                                                                         | ` `[getState](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#getState())`() ` Gets the current state of the bottom sheet.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| ` boolean`                                                                                                                                                                                                           | ` `[isHideable](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#isHideable())`() ` Gets whether this bottom sheet can hide when it is swiped down.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| ` boolean`                                                                                                                                                                                                           | ` `[onInterceptTouchEvent](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#onInterceptTouchEvent(android.support.design.widget.CoordinatorLayout, V, android.view.MotionEvent))`(`[CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout)` parent, V child, `[MotionEvent](https://developer.android.com/reference/android/view/MotionEvent.html)` event) ` Respond to CoordinatorLayout touch events before they are dispatched to child views.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ` boolean`                                                                                                                                                                                                           | ` `[onLayoutChild](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#onLayoutChild(android.support.design.widget.CoordinatorLayout, V, int))`(`[CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout)` parent, V child, int layoutDirection) ` Called when the parent CoordinatorLayout is about the lay out the given child view.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ` boolean`                                                                                                                                                                                                           | ` `[onNestedPreFling](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#onNestedPreFling(android.support.design.widget.CoordinatorLayout, V, android.view.View, float, float))`(`[CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout)` coordinatorLayout, V child, `[View](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/android/support/design/widget/BottomSheetBehavior#onNestedPreScroll(android.support.design.widget.CoordinatorLayout, V, android.view.View, int, int, int[]))`(`[CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout)` coordinatorLayout, V child, `[View](https://developer.android.com/reference/android/view/View.html)` target, int dx, int dy, int[] consumed) ` *This method is deprecated. You should now override[onNestedPreScroll(CoordinatorLayout, View, View, int, int, int[], int)](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#onNestedPreScroll(android.support.design.widget.CoordinatorLayout, V, android.view.View, int, int, int[], int)). This method will still continue to be called if the type is[TYPE_TOUCH](https://developer.android.com/reference/android/support/v4/view/ViewCompat#TYPE_TOUCH).*                                                                                                   |
| ` void`                                                                                                                                                                                                              | ` `[onRestoreInstanceState](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#onRestoreInstanceState(android.support.design.widget.CoordinatorLayout, V, android.os.Parcelable))`(`[CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout)` parent, V child, `[Parcelable](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[onSaveInstanceState(CoordinatorLayout, V)](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#onSaveInstanceState(android.support.design.widget.CoordinatorLayout, V)).                                                                                                                                                                                                                                                                                                               |
| ` `[Parcelable](https://developer.android.com/reference/android/os/Parcelable.html)                                                                                                                                  | ` `[onSaveInstanceState](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#onSaveInstanceState(android.support.design.widget.CoordinatorLayout, V))`(`[CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout)` parent, 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/android/support/design/widget/BottomSheetBehavior#onStartNestedScroll(android.support.design.widget.CoordinatorLayout, V, android.view.View, android.view.View, int))`(`[CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout)` coordinatorLayout, V child, `[View](https://developer.android.com/reference/android/view/View.html)` directTargetChild, `[View](https://developer.android.com/reference/android/view/View.html)` target, int nestedScrollAxes) ` *This method is deprecated. You should now override[onStartNestedScroll(CoordinatorLayout, View, View, View, int, int)](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#onStartNestedScroll(android.support.design.widget.CoordinatorLayout, V, android.view.View, android.view.View, int, int)). This method will still continue to be called if the type is[TYPE_TOUCH](https://developer.android.com/reference/android/support/v4/view/ViewCompat#TYPE_TOUCH).* |
| ` void`                                                                                                                                                                                                              | ` `[onStopNestedScroll](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#onStopNestedScroll(android.support.design.widget.CoordinatorLayout, V, android.view.View))`(`[CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout)` coordinatorLayout, V child, `[View](https://developer.android.com/reference/android/view/View.html)` target) ` *This method is deprecated. You should now override[onStopNestedScroll(CoordinatorLayout, View, View, int)](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#onStopNestedScroll(android.support.design.widget.CoordinatorLayout, V, android.view.View, int)). This method will still continue to be called if the type is[TYPE_TOUCH](https://developer.android.com/reference/android/support/v4/view/ViewCompat#TYPE_TOUCH).*                                                                                                                                                                                  |
| ` boolean`                                                                                                                                                                                                           | ` `[onTouchEvent](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#onTouchEvent(android.support.design.widget.CoordinatorLayout, V, android.view.MotionEvent))`(`[CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout)` parent, V child, `[MotionEvent](https://developer.android.com/reference/android/view/MotionEvent.html)` event) ` Respond to CoordinatorLayout touch events after this Behavior has started[intercepting](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#onInterceptTouchEvent(android.support.design.widget.CoordinatorLayout, V, android.view.MotionEvent))them.                                                                                                                                                                                                                                                                                                                                                                 |
| ` void`                                                                                                                                                                                                              | ` `[setBottomSheetCallback](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#setBottomSheetCallback(android.support.design.widget.BottomSheetBehavior.BottomSheetCallback))`(`[BottomSheetBehavior.BottomSheetCallback](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior.BottomSheetCallback)` callback) ` Sets a callback to be notified of bottom sheet events.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ` void`                                                                                                                                                                                                              | ` `[setHideable](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#setHideable(boolean))`(boolean hideable) ` Sets whether this bottom sheet can hide when it is swiped down.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| ` final void`                                                                                                                                                                                                        | ` `[setPeekHeight](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#setPeekHeight(int))`(int peekHeight) ` Sets the height of the bottom sheet when it is collapsed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ` void`                                                                                                                                                                                                              | ` `[setSkipCollapsed](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#setSkipCollapsed(boolean))`(boolean skipCollapsed) ` Sets whether this bottom sheet should skip the collapsed state when it is being hidden after it is expanded once.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ` final void`                                                                                                                                                                                                        | ` `[setState](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#setState(int))`(int state) ` Sets the state of the bottom sheet.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#)From class` `[android.support.design.widget.CoordinatorLayout.Behavior](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior)` ` |-------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` boolean`                                                                                                  | ` `[blocksInteractionBelow](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#blocksInteractionBelow(android.support.design.widget.CoordinatorLayout, V))`(`[CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout)` parent, V child) ` Determine whether interaction with views behind the given child in the child order should be blocked.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | | ` boolean`                                                                                                  | ` `[getInsetDodgeRect](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#getInsetDodgeRect(android.support.design.widget.CoordinatorLayout, V, android.graphics.Rect))`(`[CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout)` parent, V child, `[Rect](https://developer.android.com/reference/android/graphics/Rect.html)` rect) ` Called when a view is set to dodge view insets.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | | ` int`                                                                                                      | ` `[getScrimColor](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#getScrimColor(android.support.design.widget.CoordinatorLayout, V))`(`[CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout)` parent, V child) ` Supply a scrim color that will be painted behind the associated child view.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | | ` float`                                                                                                    | ` `[getScrimOpacity](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#getScrimOpacity(android.support.design.widget.CoordinatorLayout, V))`(`[CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout)` parent, 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.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | | ` static Object`                                                                                            | ` `[getTag](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#getTag(android.view.View))`(`[View](https://developer.android.com/reference/android/view/View.html)` child) ` Get the behavior-specific tag object with the given child view.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | | ` boolean`                                                                                                  | ` `[layoutDependsOn](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#layoutDependsOn(android.support.design.widget.CoordinatorLayout, V, android.view.View))`(`[CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout)` parent, V child, `[View](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.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | | ` `[WindowInsetsCompat](https://developer.android.com/reference/android/support/v4/view/WindowInsetsCompat) | ` `[onApplyWindowInsets](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#onApplyWindowInsets(android.support.design.widget.CoordinatorLayout, V, android.support.v4.view.WindowInsetsCompat))`(`[CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout)` coordinatorLayout, V child, `[WindowInsetsCompat](https://developer.android.com/reference/android/support/v4/view/WindowInsetsCompat)` insets) ` Called when the window insets have changed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | | ` void`                                                                                                     | ` `[onAttachedToLayoutParams](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#onAttachedToLayoutParams(android.support.design.widget.CoordinatorLayout.LayoutParams))`(`[CoordinatorLayout.LayoutParams](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.LayoutParams)` params) ` Called when the Behavior has been attached to a LayoutParams instance.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | | ` boolean`                                                                                                  | ` `[onDependentViewChanged](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#onDependentViewChanged(android.support.design.widget.CoordinatorLayout, V, android.view.View))`(`[CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout)` parent, V child, `[View](https://developer.android.com/reference/android/view/View.html)` 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.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | | ` void`                                                                                                     | ` `[onDependentViewRemoved](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#onDependentViewRemoved(android.support.design.widget.CoordinatorLayout, V, android.view.View))`(`[CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout)` parent, V child, `[View](https://developer.android.com/reference/android/view/View.html)` dependency) ` Respond to a child's dependent view being removed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | | ` void`                                                                                                     | ` `[onDetachedFromLayoutParams](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#onDetachedFromLayoutParams())`() ` Called when the Behavior has been detached from its holding LayoutParams instance.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | | ` boolean`                                                                                                  | ` `[onInterceptTouchEvent](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#onInterceptTouchEvent(android.support.design.widget.CoordinatorLayout, V, android.view.MotionEvent))`(`[CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout)` parent, V child, `[MotionEvent](https://developer.android.com/reference/android/view/MotionEvent.html)` ev) ` Respond to CoordinatorLayout touch events before they are dispatched to child views.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | | ` boolean`                                                                                                  | ` `[onLayoutChild](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#onLayoutChild(android.support.design.widget.CoordinatorLayout, V, int))`(`[CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout)` parent, V child, int layoutDirection) ` Called when the parent CoordinatorLayout is about the lay out the given child view.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | | ` boolean`                                                                                                  | ` `[onMeasureChild](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#onMeasureChild(android.support.design.widget.CoordinatorLayout, V, int, int, int, int))`(`[CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout)` parent, V child, int parentWidthMeasureSpec, int widthUsed, int parentHeightMeasureSpec, int heightUsed) ` Called when the parent CoordinatorLayout is about to measure the given child view.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | | ` boolean`                                                                                                  | ` `[onNestedFling](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#onNestedFling(android.support.design.widget.CoordinatorLayout, V, android.view.View, float, float, boolean))`(`[CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout)` coordinatorLayout, V child, `[View](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`                                                                                                  | ` `[onNestedPreFling](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#onNestedPreFling(android.support.design.widget.CoordinatorLayout, V, android.view.View, float, float))`(`[CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout)` coordinatorLayout, V child, `[View](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/android/support/design/widget/CoordinatorLayout.Behavior#onNestedPreScroll(android.support.design.widget.CoordinatorLayout, V, android.view.View, int, int, int[]))`(`[CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout)` coordinatorLayout, V child, `[View](https://developer.android.com/reference/android/view/View.html)` target, int dx, int dy, int[] consumed) ` *This method was deprecated in API level 26.1.0. You should now override[onNestedPreScroll(CoordinatorLayout, View, View, int, int, int[], int)](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#onNestedPreScroll(android.support.design.widget.CoordinatorLayout, V, android.view.View, int, int, int[], int)). This method will still continue to be called if the type is[TYPE_TOUCH](https://developer.android.com/reference/android/support/v4/view/ViewCompat#TYPE_TOUCH).*                                                                                                   | | ` void`                                                                                                     | ` `[onNestedPreScroll](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#onNestedPreScroll(android.support.design.widget.CoordinatorLayout, V, android.view.View, int, int, int[], int))`(`[CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout)` coordinatorLayout, V child, `[View](https://developer.android.com/reference/android/view/View.html)` target, int dx, int dy, 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/android/support/design/widget/CoordinatorLayout.Behavior#onNestedScroll(android.support.design.widget.CoordinatorLayout, V, android.view.View, int, int, int, int))`(`[CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout)` coordinatorLayout, V child, `[View](https://developer.android.com/reference/android/view/View.html)` target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) ` *This method was deprecated in API level 26.1.0. You should now override[onNestedScroll(CoordinatorLayout, View, View, int, int, int, int, int)](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#onNestedScroll(android.support.design.widget.CoordinatorLayout, V, android.view.View, int, int, int, int, int)). This method will still continue to be called if the type is[TYPE_TOUCH](https://developer.android.com/reference/android/support/v4/view/ViewCompat#TYPE_TOUCH).*                                                                  | | ` void`                                                                                                     | ` `[onNestedScroll](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#onNestedScroll(android.support.design.widget.CoordinatorLayout, V, android.view.View, int, int, int, int, int))`(`[CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout)` coordinatorLayout, V child, `[View](https://developer.android.com/reference/android/view/View.html)` target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int type) ` 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/android/support/design/widget/CoordinatorLayout.Behavior#onNestedScrollAccepted(android.support.design.widget.CoordinatorLayout, V, android.view.View, android.view.View, int, int))`(`[CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout)` coordinatorLayout, V child, `[View](https://developer.android.com/reference/android/view/View.html)` directTargetChild, `[View](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.                                                                                                                                                                                                                                                                                                                                                                                                                                                         | | ` void`                                                                                                     | ` `[onNestedScrollAccepted](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#onNestedScrollAccepted(android.support.design.widget.CoordinatorLayout, V, android.view.View, android.view.View, int))`(`[CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout)` coordinatorLayout, V child, `[View](https://developer.android.com/reference/android/view/View.html)` directTargetChild, `[View](https://developer.android.com/reference/android/view/View.html)` target, int axes) ` *This method was deprecated in API level 26.1.0. You should now override[onNestedScrollAccepted(CoordinatorLayout, View, View, View, int, int)](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#onNestedScrollAccepted(android.support.design.widget.CoordinatorLayout, V, android.view.View, android.view.View, int, int)). This method will still continue to be called if the type is[TYPE_TOUCH](https://developer.android.com/reference/android/support/v4/view/ViewCompat#TYPE_TOUCH).* | | ` boolean`                                                                                                  | ` `[onRequestChildRectangleOnScreen](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#onRequestChildRectangleOnScreen(android.support.design.widget.CoordinatorLayout, V, android.graphics.Rect, boolean))`(`[CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout)` coordinatorLayout, V child, `[Rect](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.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | | ` void`                                                                                                     | ` `[onRestoreInstanceState](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#onRestoreInstanceState(android.support.design.widget.CoordinatorLayout, V, android.os.Parcelable))`(`[CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout)` parent, V child, `[Parcelable](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[onSaveInstanceState(CoordinatorLayout, V)](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#onSaveInstanceState(android.support.design.widget.CoordinatorLayout, V)).                                                                                                                                                                                                                                                                                                                                    | | ` `[Parcelable](https://developer.android.com/reference/android/os/Parcelable.html)                         | ` `[onSaveInstanceState](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#onSaveInstanceState(android.support.design.widget.CoordinatorLayout, V))`(`[CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout)` parent, 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/android/support/design/widget/CoordinatorLayout.Behavior#onStartNestedScroll(android.support.design.widget.CoordinatorLayout, V, android.view.View, android.view.View, int))`(`[CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout)` coordinatorLayout, V child, `[View](https://developer.android.com/reference/android/view/View.html)` directTargetChild, `[View](https://developer.android.com/reference/android/view/View.html)` target, int axes) ` *This method was deprecated in API level 26.1.0. You should now override[onStartNestedScroll(CoordinatorLayout, View, View, View, int, int)](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#onStartNestedScroll(android.support.design.widget.CoordinatorLayout, V, android.view.View, android.view.View, int, int)). This method will still continue to be called if the type is[TYPE_TOUCH](https://developer.android.com/reference/android/support/v4/view/ViewCompat#TYPE_TOUCH).*             | | ` boolean`                                                                                                  | ` `[onStartNestedScroll](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#onStartNestedScroll(android.support.design.widget.CoordinatorLayout, V, android.view.View, android.view.View, int, int))`(`[CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout)` coordinatorLayout, V child, `[View](https://developer.android.com/reference/android/view/View.html)` directTargetChild, `[View](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/android/support/design/widget/CoordinatorLayout.Behavior#onStopNestedScroll(android.support.design.widget.CoordinatorLayout, V, android.view.View))`(`[CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout)` coordinatorLayout, V child, `[View](https://developer.android.com/reference/android/view/View.html)` target) ` *This method was deprecated in API level 26.1.0. You should now override[onStopNestedScroll(CoordinatorLayout, View, View, int)](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#onStopNestedScroll(android.support.design.widget.CoordinatorLayout, V, android.view.View, int)). This method will still continue to be called if the type is[TYPE_TOUCH](https://developer.android.com/reference/android/support/v4/view/ViewCompat#TYPE_TOUCH).*                                                                                                                                                                                  | | ` void`                                                                                                     | ` `[onStopNestedScroll](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#onStopNestedScroll(android.support.design.widget.CoordinatorLayout, V, android.view.View, int))`(`[CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout)` coordinatorLayout, V child, `[View](https://developer.android.com/reference/android/view/View.html)` target, int type) ` Called when a nested scroll has ended.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | | ` boolean`                                                                                                  | ` `[onTouchEvent](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#onTouchEvent(android.support.design.widget.CoordinatorLayout, V, android.view.MotionEvent))`(`[CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout)` parent, V child, `[MotionEvent](https://developer.android.com/reference/android/view/MotionEvent.html)` ev) ` Respond to CoordinatorLayout touch events after this Behavior has started[intercepting](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#onInterceptTouchEvent(android.support.design.widget.CoordinatorLayout, V, android.view.MotionEvent))them.                                                                                                                                                                                                                                                                                                                                                                                         | | ` static void`                                                                                              | ` `[setTag](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#setTag(android.view.View, java.lang.Object))`(`[View](https://developer.android.com/reference/android/view/View.html)` child, Object tag) ` Associate a Behavior-specific tag object with the given child view.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | ||
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#)From class` java.lang.Object ` |-------------------|-------------------------------| | ` Object`         | ` clone() `                   | | ` boolean`        | ` equals(Object arg0) `       | | ` void`           | ` finalize() `                | | ` final Class<?>` | ` getClass() `                | | ` int`            | ` hashCode() `                | | ` final void`     | ` notify() `                  | | ` final void`     | ` notifyAll() `               | | ` String`         | ` toString() `                | | ` final void`     | ` wait(long arg0, int arg1) ` | | ` final void`     | ` wait(long arg0) `           | | ` final void`     | ` wait() `                    | ||

## XML attributes

### BottomSheetBehavior_Layout_behavior_hideable

<br />

<br />

**Related methods:**

- [setHideable(boolean)](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#setHideable(boolean))

### BottomSheetBehavior_Layout_behavior_peekHeight

<br />

<br />

**Related methods:**

- [setPeekHeight(int)](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#setPeekHeight(int))

### BottomSheetBehavior_Layout_behavior_skipCollapsed

<br />

<br />

**Related methods:**

- [setSkipCollapsed(boolean)](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#setSkipCollapsed(boolean))

## Constants

### PEEK_HEIGHT_AUTO

added in[version 26.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int PEEK_HEIGHT_AUTO
```

Peek at the 16:9 ratio keyline of its parent.

This can be used as a parameter for[setPeekHeight(int)](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#setPeekHeight(int)).[getPeekHeight()](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#getPeekHeight())will return this when the value is set.

<br />

<br />

Constant Value: -1 (0xffffffff)  

### STATE_COLLAPSED

added in[version 23.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int STATE_COLLAPSED
```

The bottom sheet is collapsed.

<br />

Constant Value: 4 (0x00000004)  

### STATE_DRAGGING

added in[version 23.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int STATE_DRAGGING
```

The bottom sheet is dragging.

<br />

Constant Value: 1 (0x00000001)  

### STATE_EXPANDED

added in[version 23.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int STATE_EXPANDED
```

The bottom sheet is expanded.

<br />

Constant Value: 3 (0x00000003)  

### STATE_HIDDEN

added in[version 23.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int STATE_HIDDEN
```

The bottom sheet is hidden.

<br />

Constant Value: 5 (0x00000005)  

### STATE_SETTLING

added in[version 23.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int STATE_SETTLING
```

The bottom sheet is settling.

<br />

Constant Value: 2 (0x00000002)

## Public constructors

### BottomSheetBehavior

added in[version 23.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
BottomSheetBehavior ()
```

Default constructor for instantiating BottomSheetBehaviors.

<br />

### BottomSheetBehavior

added in[version 23.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
BottomSheetBehavior (Context context, 
                AttributeSet attrs)
```

Default constructor for inflating BottomSheetBehaviors from layout.

<br />

|                                                          Parameters                                                          ||
|-----------|-------------------------------------------------------------------------------------------------------------------|
| `context` | `Context`: The[Context](https://developer.android.com/reference/android/content/Context.html). <br />             |
| `attrs`   | `AttributeSet`: The[AttributeSet](https://developer.android.com/reference/android/util/AttributeSet.html). <br /> |

## Public methods

### from

added in[version 23.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
BottomSheetBehavior<V> from (V view)
```

A utility function to get the[BottomSheetBehavior](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior)associated with the`view`.

<br />

|                                                                                                     Parameters                                                                                                     ||
|--------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `view` | `V`: The[View](https://developer.android.com/reference/android/view/View.html)with[BottomSheetBehavior](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior). <br /> |

|                                                                                                                                   Returns                                                                                                                                   ||
|-----------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------|
| [BottomSheetBehavior](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior)`<V>` | The[BottomSheetBehavior](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior)associated with the`view`. <br /> |

### getPeekHeight

added in[version 23.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int getPeekHeight ()
```

Gets the height of the bottom sheet when it is collapsed.

<br />

**Related XML Attributes:**

- [BottomSheetBehavior_Layout_behavior_peekHeight](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#attr_BottomSheetBehavior_Layout_behavior_peekHeight)

|                                                                                                                                 Returns                                                                                                                                  ||
|-------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | The height of the collapsed bottom sheet in pixels, or[PEEK_HEIGHT_AUTO](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#PEEK_HEIGHT_AUTO)if the sheet is configured to peek automatically at 16:9 ratio keyline <br /> |

### getSkipCollapsed

added in[version 26.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
boolean getSkipCollapsed ()
```

Sets whether this bottom sheet should skip the collapsed state when it is being hidden after it is expanded once.

<br />

**Related XML Attributes:**

- [BottomSheetBehavior_Layout_behavior_skipCollapsed](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#attr_BottomSheetBehavior_Layout_behavior_skipCollapsed)

|                                   Returns                                   ||
|-----------|------------------------------------------------------------------|
| `boolean` | Whether the bottom sheet should skip the collapsed state. <br /> |

### getState

added in[version 23.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int getState ()
```

Gets the current state of the bottom sheet.

<br />

|                                                                                                                                                                                                                                                                                                                            Returns                                                                                                                                                                                                                                                                                                                            ||
|-------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | One of[STATE_EXPANDED](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#STATE_EXPANDED),[STATE_COLLAPSED](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#STATE_COLLAPSED),[STATE_DRAGGING](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#STATE_DRAGGING),[STATE_SETTLING](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#STATE_SETTLING), and[STATE_HIDDEN](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#STATE_HIDDEN). <br /> |

### isHideable

added in[version 23.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
boolean isHideable ()
```

Gets whether this bottom sheet can hide when it is swiped down.

<br />

**Related XML Attributes:**

- [BottomSheetBehavior_Layout_behavior_hideable](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#attr_BottomSheetBehavior_Layout_behavior_hideable)

|                        Returns                         ||
|-----------|---------------------------------------------|
| `boolean` | `true`if this bottom sheet can hide. <br /> |

### onInterceptTouchEvent

added in[version 23.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
boolean onInterceptTouchEvent (CoordinatorLayout parent, 
                V child, 
                MotionEvent event)
```

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[onTouchEvent(CoordinatorLayout, V, MotionEvent)](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#onTouchEvent(android.support.design.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[isShown()](https://developer.android.com/reference/android/view/View.html#isShown())on the given child.

The default implementation of this method always returns false.

<br />

<br />

|                                         Parameters                                         ||
|----------|----------------------------------------------------------------------------------|
| `parent` | `CoordinatorLayout`: the parent view currently receiving this touch event <br /> |
| `child`  | `V`: the child view associated with this Behavior <br />                         |
| `event`  | `MotionEvent`: the MotionEvent describing the touch event being processed <br /> |

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

### onLayoutChild

added in[version 23.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
boolean onLayoutChild (CoordinatorLayout parent, 
                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[parent.onLayoutChild](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout#onLayoutChild(android.view.View, int)).

If a Behavior implements[onDependentViewChanged(CoordinatorLayout, View, View)](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#onDependentViewChanged(android.support.design.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.

<br />

<br />

|                                                                                                                                                                     Parameters                                                                                                                                                                     ||
|-------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `parent`          | `CoordinatorLayout`: the parent CoordinatorLayout <br />                                                                                                                                                                                                                                                                        |
| `child`           | `V`: child view to lay out <br />                                                                                                                                                                                                                                                                                               |
| `layoutDirection` | `int`: the resolved layout direction for the CoordinatorLayout, such as[LAYOUT_DIRECTION_LTR](https://developer.android.com/reference/android/support/v4/view/ViewCompat#LAYOUT_DIRECTION_LTR)or[LAYOUT_DIRECTION_RTL](https://developer.android.com/reference/android/support/v4/view/ViewCompat#LAYOUT_DIRECTION_RTL). <br /> |

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

### onNestedPreFling

added in[version 23.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
boolean onNestedPreFling (CoordinatorLayout coordinatorLayout, 
                V child, 
                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[onStartNestedScroll(CoordinatorLayout, V, View, View, int)](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#onStartNestedScroll(android.support.design.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.

<br />

<br />

|                                                         Parameters                                                         ||
|---------------------|-------------------------------------------------------------------------------------------------------|
| `coordinatorLayout` | `CoordinatorLayout`: the CoordinatorLayout parent of the view this Behavior is associated with <br /> |
| `child`             | `V`: the child view of the CoordinatorLayout this Behavior is associated with <br />                  |
| `target`            | `View`: the descendant view of the CoordinatorLayout performing the nested scroll <br />              |
| `velocityX`         | `float`: horizontal velocity of the attempted fling <br />                                            |
| `velocityY`         | `float`: vertical velocity of the attempted fling <br />                                              |

|                          Returns                          ||
|-----------|------------------------------------------------|
| `boolean` | true if the Behavior consumed the fling <br /> |

### onNestedPreScroll

added in[version 23.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

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

<br />

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

<br />

<br />

|                   Parameters                    ||
|---------------------|----------------------------|
| `coordinatorLayout` | `CoordinatorLayout` <br /> |
| `child`             | `V` <br />                 |
| `target`            | `View` <br />              |
| `dx`                | `int` <br />               |
| `dy`                | `int` <br />               |
| `consumed`          | `int` <br />               |

### onRestoreInstanceState

added in[version 23.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

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

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

<br />

|                                                                                                                                             Parameters                                                                                                                                              ||
|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `parent` | `CoordinatorLayout`: the parent CoordinatorLayout <br />                                                                                                                                                                                                                                  |
| `child`  | `V`: child view to restore from <br />                                                                                                                                                                                                                                                    |
| `state`  | `Parcelable`: The frozen state that had previously been returned by[onSaveInstanceState(CoordinatorLayout, V)](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#onSaveInstanceState(android.support.design.widget.CoordinatorLayout, V)). <br /> |

### onSaveInstanceState

added in[version 23.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
Parcelable onSaveInstanceState (CoordinatorLayout parent, 
                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[CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout)and a view using this behavior have valid IDs set.

<br />

<br />

|                             Parameters                             ||
|----------|----------------------------------------------------------|
| `parent` | `CoordinatorLayout`: the parent CoordinatorLayout <br /> |
| `child`  | `V`: child view to restore from <br />                   |

|                                                                                Returns                                                                                ||
|----------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
| [Parcelable](https://developer.android.com/reference/android/os/Parcelable.html) | Returns a Parcelable object containing the behavior's current dynamic state. <br /> |

### onStartNestedScroll

added in[version 23.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
boolean onStartNestedScroll (CoordinatorLayout coordinatorLayout, 
                V child, 
                View directTargetChild, 
                View target, 
                int nestedScrollAxes)
```

<br />

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

<br />

<br />

|                   Parameters                    ||
|---------------------|----------------------------|
| `coordinatorLayout` | `CoordinatorLayout` <br /> |
| `child`             | `V` <br />                 |
| `directTargetChild` | `View` <br />              |
| `target`            | `View` <br />              |
| `nestedScrollAxes`  | `int` <br />               |

|      Returns      ||
|-----------|--------|
| `boolean` | <br /> |

### onStopNestedScroll

added in[version 23.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void onStopNestedScroll (CoordinatorLayout coordinatorLayout, 
                V child, 
                View target)
```

<br />

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

<br />

<br />

|                   Parameters                    ||
|---------------------|----------------------------|
| `coordinatorLayout` | `CoordinatorLayout` <br /> |
| `child`             | `V` <br />                 |
| `target`            | `View` <br />              |

### onTouchEvent

added in[version 23.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
boolean onTouchEvent (CoordinatorLayout parent, 
                V child, 
                MotionEvent event)
```

Respond to CoordinatorLayout touch events after this Behavior has started[intercepting](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior#onInterceptTouchEvent(android.support.design.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[isShown()](https://developer.android.com/reference/android/view/View.html#isShown())on the given child.

<br />

<br />

|                                         Parameters                                         ||
|----------|----------------------------------------------------------------------------------|
| `parent` | `CoordinatorLayout`: the parent view currently receiving this touch event <br /> |
| `child`  | `V`: the child view associated with this Behavior <br />                         |
| `event`  | `MotionEvent`: the MotionEvent describing the touch event being processed <br /> |

|                                                                            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. <br /> |

### setBottomSheetCallback

added in[version 23.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void setBottomSheetCallback (BottomSheetBehavior.BottomSheetCallback callback)
```

Sets a callback to be notified of bottom sheet events.

<br />

|                                                      Parameters                                                      ||
|------------|----------------------------------------------------------------------------------------------------------|
| `callback` | `BottomSheetBehavior.BottomSheetCallback`: The callback to notify when bottom sheet events occur. <br /> |

### setHideable

added in[version 23.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void setHideable (boolean hideable)
```

Sets whether this bottom sheet can hide when it is swiped down.

<br />

**Related XML Attributes:**

- [BottomSheetBehavior_Layout_behavior_hideable](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#attr_BottomSheetBehavior_Layout_behavior_hideable)

|                               Parameters                               ||
|------------|------------------------------------------------------------|
| `hideable` | `boolean`:`true`to make this bottom sheet hideable. <br /> |

### setPeekHeight

added in[version 23.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void setPeekHeight (int peekHeight)
```

Sets the height of the bottom sheet when it is collapsed.

<br />

**Related XML Attributes:**

- [BottomSheetBehavior_Layout_behavior_peekHeight](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#attr_BottomSheetBehavior_Layout_behavior_peekHeight)

|                                                                                                                                     Parameters                                                                                                                                      ||
|--------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `peekHeight` | `int`: The height of the collapsed bottom sheet in pixels, or[PEEK_HEIGHT_AUTO](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#PEEK_HEIGHT_AUTO)to configure the sheet to peek automatically at 16:9 ratio keyline. <br /> |

### setSkipCollapsed

added in[version 26.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void setSkipCollapsed (boolean skipCollapsed)
```

Sets whether this bottom sheet should skip the collapsed state when it is being hidden after it is expanded once. Setting this to true has no effect unless the sheet is hideable.

<br />

**Related XML Attributes:**

- [BottomSheetBehavior_Layout_behavior_skipCollapsed](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#attr_BottomSheetBehavior_Layout_behavior_skipCollapsed)

|                                          Parameters                                          ||
|-----------------|-----------------------------------------------------------------------------|
| `skipCollapsed` | `boolean`: True if the bottom sheet should skip the collapsed state. <br /> |

### setState

added in[version 23.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void setState (int state)
```

Sets the state of the bottom sheet. The bottom sheet will transition to that state with animation.

<br />

|                                                                                                                                                                                                   Parameters                                                                                                                                                                                                    ||
|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `state` | `int`: One of[STATE_COLLAPSED](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#STATE_COLLAPSED),[STATE_EXPANDED](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#STATE_EXPANDED), or[STATE_HIDDEN](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior#STATE_HIDDEN). <br /> |

-

  ## Annotations

  - [CoordinatorLayout.DefaultBehavior](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.DefaultBehavior)
-

  ## Interfaces

  - [AppBarLayout.OnOffsetChangedListener](https://developer.android.com/reference/android/support/design/widget/AppBarLayout.OnOffsetChangedListener)
  - [BaseTransientBottomBar.ContentViewCallback](https://developer.android.com/reference/android/support/design/widget/BaseTransientBottomBar.ContentViewCallback)
  - [BottomNavigationView.OnNavigationItemReselectedListener](https://developer.android.com/reference/android/support/design/widget/BottomNavigationView.OnNavigationItemReselectedListener)
  - [BottomNavigationView.OnNavigationItemSelectedListener](https://developer.android.com/reference/android/support/design/widget/BottomNavigationView.OnNavigationItemSelectedListener)
  - [CoordinatorLayout.AttachedBehavior](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.AttachedBehavior)
  - [NavigationView.OnNavigationItemSelectedListener](https://developer.android.com/reference/android/support/design/widget/NavigationView.OnNavigationItemSelectedListener)
  - [SwipeDismissBehavior.OnDismissListener](https://developer.android.com/reference/android/support/design/widget/SwipeDismissBehavior.OnDismissListener)
  - [TabLayout.OnTabSelectedListener](https://developer.android.com/reference/android/support/design/widget/TabLayout.OnTabSelectedListener)
-

  ## Classes

  - [AppBarLayout](https://developer.android.com/reference/android/support/design/widget/AppBarLayout)
  - [AppBarLayout.Behavior](https://developer.android.com/reference/android/support/design/widget/AppBarLayout.Behavior)
  - [AppBarLayout.Behavior.DragCallback](https://developer.android.com/reference/android/support/design/widget/AppBarLayout.Behavior.DragCallback)
  - [AppBarLayout.Behavior.SavedState](https://developer.android.com/reference/android/support/design/widget/AppBarLayout.Behavior.SavedState)
  - [AppBarLayout.LayoutParams](https://developer.android.com/reference/android/support/design/widget/AppBarLayout.LayoutParams)
  - [AppBarLayout.ScrollingViewBehavior](https://developer.android.com/reference/android/support/design/widget/AppBarLayout.ScrollingViewBehavior)
  - [BaseTransientBottomBar](https://developer.android.com/reference/android/support/design/widget/BaseTransientBottomBar)
  - [BaseTransientBottomBar.BaseCallback](https://developer.android.com/reference/android/support/design/widget/BaseTransientBottomBar.BaseCallback)
  - [BottomNavigationView](https://developer.android.com/reference/android/support/design/widget/BottomNavigationView)
  - [BottomSheetBehavior](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior)
  - [BottomSheetBehavior.BottomSheetCallback](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior.BottomSheetCallback)
  - [BottomSheetBehavior.SavedState](https://developer.android.com/reference/android/support/design/widget/BottomSheetBehavior.SavedState)
  - [BottomSheetDialog](https://developer.android.com/reference/android/support/design/widget/BottomSheetDialog)
  - [BottomSheetDialogFragment](https://developer.android.com/reference/android/support/design/widget/BottomSheetDialogFragment)
  - [CollapsingToolbarLayout](https://developer.android.com/reference/android/support/design/widget/CollapsingToolbarLayout)
  - [CollapsingToolbarLayout.LayoutParams](https://developer.android.com/reference/android/support/design/widget/CollapsingToolbarLayout.LayoutParams)
  - [CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout)
  - [CoordinatorLayout.Behavior](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior)
  - [CoordinatorLayout.LayoutParams](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.LayoutParams)
  - [CoordinatorLayout.SavedState](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.SavedState)
  - [FloatingActionButton](https://developer.android.com/reference/android/support/design/widget/FloatingActionButton)
  - [FloatingActionButton.Behavior](https://developer.android.com/reference/android/support/design/widget/FloatingActionButton.Behavior)
  - [FloatingActionButton.OnVisibilityChangedListener](https://developer.android.com/reference/android/support/design/widget/FloatingActionButton.OnVisibilityChangedListener)
  - [NavigationView](https://developer.android.com/reference/android/support/design/widget/NavigationView)
  - [NavigationView.SavedState](https://developer.android.com/reference/android/support/design/widget/NavigationView.SavedState)
  - [Snackbar](https://developer.android.com/reference/android/support/design/widget/Snackbar)
  - [Snackbar.Callback](https://developer.android.com/reference/android/support/design/widget/Snackbar.Callback)
  - [SwipeDismissBehavior](https://developer.android.com/reference/android/support/design/widget/SwipeDismissBehavior)
  - [TabItem](https://developer.android.com/reference/android/support/design/widget/TabItem)
  - [TabLayout](https://developer.android.com/reference/android/support/design/widget/TabLayout)
  - [TabLayout.Tab](https://developer.android.com/reference/android/support/design/widget/TabLayout.Tab)
  - [TabLayout.TabLayoutOnPageChangeListener](https://developer.android.com/reference/android/support/design/widget/TabLayout.TabLayoutOnPageChangeListener)
  - [TabLayout.ViewPagerOnTabSelectedListener](https://developer.android.com/reference/android/support/design/widget/TabLayout.ViewPagerOnTabSelectedListener)
  - [TextInputEditText](https://developer.android.com/reference/android/support/design/widget/TextInputEditText)
  - [TextInputLayout](https://developer.android.com/reference/android/support/design/widget/TextInputLayout)