0

I have a recycler view below my appbar, and it expands when I'm at the top of my RV and I scroll up one more time. I need my collapsed toolbar to expand when the smooth scrolling animation reaches the top, so I don't need to scroll up again. Instead what I get is that I scroll to the top, and my RV stops, then I have to scroll again just to expand the collapsed toolbar.

I am currently looking into MotionLayout, because in this answer I've read it offers easier behavior customization https://stackoverflow.com/a/55328600/13150066

I don't know how to upload videos here, but if you have an idea and want to check out the behavior I want, check out spotify's playlist.

Is there a solution to my problem so I don't have to change to MotionLayout?

Lheonair
  • 468
  • 5
  • 14

1 Answers1

0

I had to take a look at those MotionLayout and it's super easy. Made it work!

I downloaded Android Studio 4.1 so I could use the new layout design interface and it work wonders. Honestly I thought it was going to be really difficult to achieve, this effect, but it was really simple, and everything is pretty self explainatory. Anyways, I'm leaving you the tutorial I did it with, hope it helps!

https://blog.stylingandroid.com/motionlayout-collapsing-toolbar-part-1/

I think the most beneficial part of using MotionLayout is that it extends from ConstraintLayout, so your Layouts are laid flat. No Collapsing Toolbar inside an AppBar, with a Toolbar and an ImageView nested. Using MotionLayout, I only used an imageView laid flat and the animations are set in a new XML.

Lheonair
  • 468
  • 5
  • 14