Bottomsheet Fly Away With Visibility Change
Solution 1:
I ran into this, took a while to figure out what was the cause.
It's because you're using android:animateLayoutChanges, which surfaces a bug in either BottomSheetBehavior or CoordinatorLayout.
Remove it and the BottomSheet will stop animating on its own when it shouldn't. Not a fix, but a workaround at least.
--
Update:
Turns out that if you enable "animateLayoutChanges" programmatically by setting the LayoutTransition instance to use, you can set a flag on it that will prevent it from messing with views that are ancestors of the one you're using android:animateLayoutChanges on (aka: your BottomSheet container):
LayoutTransitiontransition=newLayoutTransition();
transition.setAnimateParentHierarchy(false);
yourLinearLayoutThatNeedsLayoutAnimation.setLayoutTransition(transition);
Solution 2:
Removing the following line from my root layout solved this problem:
android:animateLayoutChanges="true"
Solution 3:
As a workaround, you need to remove the android:animateLayoutChanges="true"
from the parent coordinator layout
Solution 4:
Try to make the parent of bottomSheet
an independent CoordinatorLayout
without having any other child Views
. For example:
<RelativeLayoutandroid:id="@+id/some_id"android:layout_width="match_parent"android:layout_height="match_parent"><Some_View.../><Some_Other_view>
.
.
.</Some_Other_view><androidx.coordinatorlayout.widget.CoordinatorLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:layout_alignParentBottom="true"><includeandroid:id="@+id/included_layout"layout="@layout/bottom_sheet" /></androidx.coordinatorlayout.widget.CoordinatorLayout></RelativeLayout>
Solution 5:
Change View.GONE
to View.INVISIBLE
. Since the View.GONE
has no size, the bottom sheet can't compute the height of the child being updated.
Post a Comment for "Bottomsheet Fly Away With Visibility Change"