how to add headers/titles for cards in a recyclerview?
Asked Answered
E

1

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

Eaten answered 12/1, 2017 at 16:14 Comment(3)
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.Godewyn
but it is one recycler view?Eaten
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.Godewyn
O
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?

Octo answered 12/1, 2017 at 16:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.