android tutorial - Using several viewHolders with itemviewtype in android | Developer android - android app development
- android studio - android app developement
Sometimes a RecyclerView will need to use several types of Views to be displayed
in the list shown in the UI, and each View needs a different layout xml to be inflated.
For this issue, you may use different ViewHolders in single Adapter, by using a special method in RecyclerView - getItemViewType(int position).
Below is example of using two ViewHolders:
A ViewHolder for displaying list
entries
A ViewHolder for displaying multiple header views