
View = LayoutInflater.From(parent.Context).Inflate(_user_writepostbar, parent, false)

Method OnCreateViewHolder public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) Method GetItemViewType public override int GetItemViewType(int position)

The RecyclerView will handle recycling different view types in a way which avoids clashing of different view types.įor example: (assume you can match your viewholders with your object's field Type) private const int LAYOUT_ONE = 0 In your case, it is not so, and so you will need find a way to assert which row corresponds to which view type.īesides,when we should notice the viewType parameter of following method: public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)Īccording to the view type, we'll need to inflate the correct layout resource and create our view holder accordingly. This method's default implementation will always return 0, indicating that there is only 1 type of view. When RecyclerView has multiple ViewHolders, we usually override GetItemViewType method.

But the item that previously followed the removed item needs to be updated, not with different data, but as a different ItemViewType.
