I have a bottom sheet with its height and width set to match_parent . Therefore, when I press the button, I set the behavior to STATE_EXPANDED as follows:
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
My Bottomsheet is defined below:
<FrameLayout android:id="@+id/bottom_sheet" android:layout_width="match_parent" android:layout_height="match_parent" android:clickable="true" android:elevation="@dimen/design_appbar_elevation" app:behavior_hideable="true" app:layout_behavior="@string/bottom_sheet_behavior"> <include android:id="@+id/bottom_sheet_content" layout="@layout/bottomsheet_layout" /> </FrameLayout>
I am tracking state with BottomSheet callbacks.
- I press a button and the bottom sheet expands to full screen.
- Current status is
STATE_EXPANDED - I quickly scroll through the bottom sheet. (Do not completely drag until it is closed, just swipe down like a scroll).
- It stops in the middle and its state is written as
STATE_COLLAPSED - If I spent it again, everything disappeared, and its state is
STATE_HIDDEN
I do not understand why he stops in the middle. How can I hide it with one click.
I tried this by setting peek_height to 0dp . Thus, he never encounters STATE_HIDDEN . When hidden, its state becomes STATE_COLLAPSED . I just do not understand these conditions.
How to reach STATE_HIDDEN one hit down?
source share