1

I have a RecyclerView that needs to recycle many rows (a long list of contacts). However, I'd like to have these rows scroll in step with a "header" of sorts. This header will be composed of two Fragments because these complex views with database and network access need to be reused in two separate places in the application.

How would I go about placing two Fragments as the header of a RecyclerView? Or is there a better way to accomplish a similar scrolling behavior with reusable elements above recycled rows?

pfue
  • 278
  • 1
  • 5
  • 16

1 Answers1

0

Unfortunately, recycler views don't offer an easy out of the box solution for having headers.

My suggestion is that you add rows of multiple types and use logic in the adapter to determine whether to show a header or a normal row depending on the type.

Take a look at this answer to a similar question.

Community
  • 1
  • 1