miguelhincapie/CustomBottomSheetBehavior

Shows wrong content position after close button click (STATE_EXPANDED to STATE_COLLAPSED)

lordmegamax opened this issue · 2 comments

I have a lot of text inside the content part and if I open the bottom part to STATE_EXPANDED, scroll to some lower lines of the text and then click the close (back) button in toolbar the view changes it's state to STATE_COLLAPSED but I don't see buttons at the top. Instead I see my text. See attached video.

I tried to catch STATE_COLLAPSED in onStateChanged and scoll manually by nestedScrollView.post(() -> nestedScrollView.fullScroll(View.FOCUS_UP)); but it not always work.
Instead if I use this in STATE_SETTLING it works well every time but very slows down the graphics and hangs the animation as well.

https://www.dropbox.com/s/uba3vokrlnypgma/CustomBottomSheetBehavior_bug.mp4?dl=0

Did you tried to call fullScroll right after the setState instead of catching it on onStateChanged? I didn't had problems with fullScroll(View.FOCUS_UP) at all.

behavior.setState(STATE_COLLAPSED);
nestedScrollView.fullScroll(View.FOCUS_UP);

@cesardeazevedo Thanks for your answer. I can't make it work for me so I'm going to remove the close button at all for now.