CustomBottomSheetBehavior
CustomBottomSheetBehavior copied to clipboard
Viewpageer behavior wrong when set state is STATE_HIDDEN
I want to hide bottom sheet when activity create, so I set state as STATE_HIDDEN in onCreate() function CoordinatorLayout coordinatorLayout = (CoordinatorLayout) findViewById(R.id.coordinatorlayout); View bottomSheet = coordinatorLayout.findViewById(R.id.bottom_sheet); behavior = BottomSheetBehaviorGoogleMapsLike.from(bottomSheet); behavior.setState(BottomSheetBehaviorGoogleMapsLike.STATE_HIDDEN); But I got the this issue. Check out image : https://goo.gl/M8bKpk When I set state as STATE_COLLAPSED onCreate() funtion, it works fine.
https://goo.gl/M8bKpk
Error 403
I confirm. When behavior initialized as STATE_HIDDEN in onCreate() something wrong.
When I set the state as STATE_COLLAPSED, when the button click, the FAB does not show
I logged ScrollAwareFABBehavior.onDependentViewChanged() and see
onDependentViewChanged child.getY()=24905.0 DyFix=0 offset=112.0
The value child.getY() is not correct and is constantly increasing
When view hide, actually view is gone. So it loses its correct position. Fix code.
ScrollAwareFABBehavior.onDependentViewChanged()
if ((child.getY() + DyFix) > collapsedY) child.setVisibility(View.INVISIBLE); else if(child.isShown()) child.setVisibility(View.VISIBLE); else child.Show();
I can confirm the above fix works.
Thanks @leeyc09 Would you mind creating a merge request to close this issue for others?