How to scroll 1st and 3rd elements keeping the 2nd/middle one visible (CordinatorLayout + AppBarLayout)

17 Views Asked by At

I'm pretty new on Android Development, so sorry in advance if I'm asking is something super basic.

I'm creating an app that has 3 components/bars stacked on top of each other, and a list below. What I want to achieve is, when I scroll this list, both bars #1 and #3 scroll together hiding and showing themselves, but NOT the #2, like this:

desired behavior when scrolling

I'm structuring the elements like this:

  • CoordinatorLayout
    • AppBarLayout
      • element 1
      • element 2
      • element 3
    • LinearLayoutCompat
      • RecyclerView

I've set the layout_scrollFlags for both element 1 & 3 as "scroll|enterAlways", but when i scroll the list, only the element #1 seems to scroll together, and not the 3.

Is it possible to achieve the desired behavior using CordinatorLayout + AppBarLayout? Or is there an alternative way to do this?

Thanks!

0

There are 0 best solutions below