Layout with collapsing view on scroll Android

37 Views Asked by At

My layout contains three views: View A, View B and a RecyclerView. View A is on top, View B is below View A. Then, the RecyclerView is below View B. I want to achieve the following behavior: When the RecyclerView scrolls up, I want the View B to collapse first under View A. Then, View A should scroll with the RecyclerView. This is similar to iPhone's settings screen where View A is the toolbar, View B is the Search Bar. How can I achieve this?

enter image description here

I tried using a CoordinatorLayout with an AppBarLayout. I placed the View A and the View B inside the AppBarLayout. But, I am unable to achieve the View B collapsing under View A

0

There are 0 best solutions below