how to make grid layout in recyclerview android code example
Example 1: how to use mutliple layouts in recyclerview
@Override
public int getItemViewType(int position) {
if(user_id_array.get(position).equals(user_one))
return 1;
else if(user_id_array.get(position).equals(user_two))
return 2;
else
return 3;
}
Example 2: how to set number of columns in recyclerview android
.//Add in recyclerView widget in xml file
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:spanCount="2"