Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Viewpageer behavior wrong when set state is STATE_HIDDEN #45

Open
ThuyKhanh opened this issue Apr 11, 2017 · 4 comments
Open

Viewpageer behavior wrong when set state is STATE_HIDDEN #45

ThuyKhanh opened this issue Apr 11, 2017 · 4 comments

Comments

@ThuyKhanh
Copy link

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.

@lordmegamax
Copy link

https://goo.gl/M8bKpk

Error 403

@krawa
Copy link

krawa commented May 15, 2017

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

@leeyc09
Copy link

leeyc09 commented May 18, 2017

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();

@vojtisek-michal
Copy link

I can confirm the above fix works.

Thanks @leeyc09
Would you mind creating a merge request to close this issue for others?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants