Reputation: 91
There are around six different states in BottomSheetBehavior
. I did not get any proper explanation of them.
Like I don't understand difference between STATE_HIDDEN
and STATE_COLLAPSED
?
Similarly what is difference between STATE_SETTLING
and STATE_DRAGGING
?
Also what is the use of STATE_HALF_EXPANDED
?
Upvotes: 8
Views: 8213
Reputation: 1221
As guided in this article https://androidwave.com/bottom-sheet-behavior-in-android/
The Bottom Sheet mainly have 5 states
-
The diference in the STATE_HIDDEN and STATE_COLLAPSED
is that the when the BottomSheet
is in the STATE_HIDDEN
then it is totally hidden i.e. it is not visible on the screen, while when it is in the STATE_COLLAPSED
then only the peek height is visible.
When the BottomSheet
is in the STATE_SETTLING
then it is either expanding or collapsing after a drag or swipe to a specific height, while STATE_DRAGGING
is the state when when the user is dragging the BottomSheet.
STATE_HALF_EXPANDED
is the state when the bottom sheet is in the half expanded state.
Upvotes: 15
Reputation: 9039
STATE_COLLAPSED
-> bottomsheet is visible but only showing its peek height. This state is usually the ‘resting position’ of a Bottom Sheet. The peek height is chosen by the developer and should be enough to indicate there is extra content, allow the user to trigger an action or expand the bottom sheet.
STATE_HIDDEN
-> bottomsheet is no longer visible on screen
STATE_EXPANDED
-> bottom sheet is visible and its maximum height and it is neither dragging or settling
STATE_DRAGGING
-> The user is actively dragging the bottom sheet up or down.
STATE_SETTLING
-> bottomsheet is settling to specific height after a drag/swipe gesture. This will be the peek height, expanded height, or 0, in case the user action caused the bottom sheet to hide.
STATE_HALF_EXPANDED
-> The sheet is half-expanded(half visible). (only applicable if behavior_fitToContents has been set to false).
For more information, you can visit here
Upvotes: 4