Reputation: 145
I have activity with CoordinatorLayout, where I've put FrameLayout with BottomSheetBehavior. I use this FrameLayout as root view for my pop-up views, so that they behave like BottomSheetDialog. It works fine until I open another activity for result and go back to my activity with result. After this all views with that FrameLayout as root are shown in the center of screen instead of bottom? What might be the reason and fix for this? The problem doesn't appear if I just click home button and reopen the app. Here's the code: https://gist.github.com/yusufabd/d4fca0e3d163bd5fff0ecffea7935ceb
There is showCard() method in activity which handles BottomSheetBehavior and showFeedbackCard(), showTipCard() and showRateCard() where I build the view with FrameLayout (lCard) as its root
Upvotes: 2
Views: 1191
Reputation: 420
add this in your activity onResume
method
try {
behavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
}catch (Exception e){}
here behavior
is your bottom sheet behavior
below code is for you to know what behavior
is:
bottomSheet = coordinatorLayout.findViewById(R.id.bottom_sheet);
behavior = BottomSheetBehavior.from(bottomSheet);
Upvotes: 1