Bottom Sheet Behavior
An interaction behavior plugin for a child view of CoordinatorLayout to make it work as a bottom sheet.
To send useful accessibility events, set a title on bottom sheets that are windows or are window-like. For BottomSheetDialog use setTitle, and for BottomSheetDialogFragment use setAccessibilityPaneTitle.
For more information, see the component developer guidance and design guidelines.
Types
Link copied to clipboard
Callback for monitoring events about bottom sheets.
Link copied to clipboard
Link copied to clipboard
Stable states that can be set by the setState method.
Link copied to clipboard
Properties
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Peek at the 16:9 ratio keyline of its parent.
Link copied to clipboard
Peek height set by the user.
Link copied to clipboard
This flag will preserve the fitToContents boolean value on configuration change.
Link copied to clipboard
This flag will preserve the hideable boolean value on configuration change.
Link copied to clipboard
This flag will preserve the peekHeight int value on configuration change.
Link copied to clipboard
This flag will preserve the skipCollapsed boolean value on configuration change.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
The bottom sheet is collapsed.
Link copied to clipboard
The bottom sheet is dragging.
Link copied to clipboard
The bottom sheet is expanded.
Link copied to clipboard
The bottom sheet is half-expanded (used when fitToContents is false).
Link copied to clipboard
The bottom sheet is hidden.
Link copied to clipboard
The bottom sheet is settling.
Functions
Link copied to clipboard
Adds a callback to be notified of bottom sheet events.
Link copied to clipboard
Calculates the current offset of the bottom sheet.
Link copied to clipboard
Call this method from onBackCancelled or handleOnBackCancelled so that the back handler can cancel the back animation.
Link copied to clipboard
Disables the shaped corner ShapeAppearanceModel interpolation transition animations.
Link copied to clipboard
A utility function to get the BottomSheetBehavior associated with the
view
.Link copied to clipboard
Call this method from onBackInvoked or handleOnBackPressed so that the back handler can complete the back animation, or handle back without progress in certain cases.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Returns whether this bottom sheet should adjust it's position based on the system gesture area.
Link copied to clipboard
Gets whether this bottom sheet can hide when it is swiped down.
Link copied to clipboard
Checks whether hiding gestures should be enabled while
isHideable
is set to true.Link copied to clipboard
Checks weather a nested scroll should be enabled.
Link copied to clipboard
Returns whether the bottom sheet will remove its corners when it reaches the expanded state.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun onInterceptTouchEvent(@NonNull parent: CoordinatorLayout, @NonNull child: V, @NonNull event: MotionEvent): Boolean
Link copied to clipboard
open fun onLayoutChild(@NonNull parent: CoordinatorLayout, @NonNull child: V, layoutDirection: Int): Boolean
Link copied to clipboard
open fun onMeasureChild(@NonNull parent: CoordinatorLayout, @NonNull child: V, parentWidthMeasureSpec: Int, widthUsed: Int, parentHeightMeasureSpec: Int, heightUsed: Int): Boolean
Link copied to clipboard
open fun onNestedPreFling(@NonNull coordinatorLayout: CoordinatorLayout, @NonNull child: V, @NonNull target: View, velocityX: Float, velocityY: Float): Boolean
Link copied to clipboard
Link copied to clipboard
open fun onRestoreInstanceState(@NonNull parent: CoordinatorLayout, @NonNull child: V, @NonNull state: Parcelable)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun onStopNestedScroll(@NonNull coordinatorLayout: CoordinatorLayout, @NonNull child: V, @NonNull target: View, type: Int)
Link copied to clipboard
open fun onTouchEvent(@NonNull parent: CoordinatorLayout, @NonNull child: V, @NonNull event: MotionEvent): Boolean
Link copied to clipboard
Removes a previously added callback.
Link copied to clipboard
Sets a callback to be notified of bottom sheet events.
Link copied to clipboard
Sets whether this bottom sheet is can be collapsed/expanded by dragging.
Link copied to clipboard
Sets whether the height of the expanded sheet is determined by the height of its contents, or if it is expanded in two stages (half the height of the parent container, full height of parent container).
Link copied to clipboard
Sets whether this bottom sheet should adjust it's position based on the system gesture area on Android Q and above.
Link copied to clipboard
Sets whether this bottom sheet can hide.
Link copied to clipboard
Sets whether this bottom sheet can hide when it is swiped down.
Link copied to clipboard
Sets the height of the bottom sheet when it is collapsed while optionally animating between the old height and the new height.
Link copied to clipboard
Sets whether the bottom sheet should remove its corners when it reaches the expanded state.
Link copied to clipboard
open fun setUpdateImportantForAccessibilityOnSiblings(updateImportantForAccessibilityOnSiblings: Boolean)
Sets whether the BottomSheet should update the accessibility status of its siblings when expanded.
Link copied to clipboard
open fun shouldExpandOnUpwardDrag(dragDurationMillis: Long, @FloatRange(from = 0.0,
Checks whether the bottom sheet should be expanded after it has been released after dragging.
Link copied to clipboard
Checks weather half expended state should be skipped when drag is ended.
Link copied to clipboard
Checks whether an animation should be smooth after the bottomSheet is released after dragging.
Link copied to clipboard
Call this method from onBackStarted or handleOnBackStarted so that the back handler can initialize and start animating.
Link copied to clipboard
Call this method from onBackProgressed or handleOnBackProgressed so that the back handler can continue animating with a new progress value.