0

I was trying to design my screen as of same in Swiggy App. First, it has horizontal recycler or horizontal scroll view.

Second, it has tab bar which will stick on the top once we will scroll up. Third, it has a vertical recycler view or maybe listView showing restaurants. So, if we have vertical listView, it's very easy to stick that tab bar(view, the second thing on screen) on the top.

You can see an example here: https://dzone.com/articles/creating-a-listview-parallax-effect-with-a-sticky

But in case of RecyclerView, it doesn't have any direct method addHeaderView. So how do we implement this with RecyclerView.

Ramesh sambu
  • 3,577
  • 2
  • 24
  • 39
Minkoo
  • 439
  • 1
  • 3
  • 16
  • have look [this](https://stackoverflow.com/a/26573338/5110595) – Hemant Parmar Dec 22 '17 at 11:25
  • Yes, I have tried this, it gives you a header space not working fine. It just adds a space for the header on the top of the list. But doesn't move that sticky header. – Minkoo Dec 22 '17 at 11:30
  • Possible duplicate of [Is there an addHeaderView equivalent for RecyclerView?](https://stackoverflow.com/questions/26530685/is-there-an-addheaderview-equivalent-for-recyclerview) – Vladyslav Matviienko Dec 22 '17 at 11:54

1 Answers1

-1

Use getItemViewType method and create three view holders for first, middle and last items.

RecyclerView with multiple view type

Ecnill
  • 41
  • 6