You should use getItemViewType()
of the RecyclerView.Adapter
. Return different values for different views in that callback. You will receive that value in viewType
of onCreateViewHolder
callback. Inflate different layouts based on the viewType
.
solved How do I add two view types in a Recycler adapter? I want to make a Android Chatting App [closed]