6

I have a short question. How is it possible to make headers for groups on cards on a recyclerview like of the image below.

enter image description here

Thanks a lot for answers

Johannes
  • 481
  • 1
  • 5
  • 16
  • I think those headers are part of other View, which is below the CardView. Looks similar to Google Calendar stuff, so when you scroll, you can see the background changing. But perhaps here you should scroll both CardView and Background at same time. Just a thought. – David Kasabji Jan 12 '17 at 16:16
  • but it is one recycler view? – Johannes Jan 12 '17 at 16:18
  • 1
    Johannes unfortunately I haven't really used what you want to do. Only used CardViews. Maybe check ArtiChoke's answer, there might be what you seek. – David Kasabji Jan 12 '17 at 16:19

1 Answers1

4

You need to set another type of ViewHolder in the RecyclerView, and override the method getItemViewType to select which ones you need to paint. You can learn more about this in How to create RecyclerView with multiple view type?

Community
  • 1
  • 1
Alvaro
  • 491
  • 3
  • 16