So this is the showcase how one can populate a RecyclerView with different types of items:
- No switch-case inside an
RecyclerView.Adapter. - No
RecyclerView.Adapterdelegates for each view type. - Single
RecyclerView.Adapterclass that suits all items in the application. - Forces you to separate business models from UI models.
- Still can provide more than just 1:1 mapping via a custom
RecyclerView.ViewHolder. See a nestedRecyclerViewin the example.
Useful links:
