For the RecycleView layouts in a grid form with different cell spans can be achieved by using the GridLayoutManager. You will find many tutorials in the internet about how to implement it.
GridLayoutManager layoutManager = new GridLayoutManager(this, 6);
layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
// Use whatever logic you need here to decide how
// many columns to span for any given row position
if (position % 2)
return 3;
else
return 6;
}
});
Then in onBindViewHolder update the LayoutParams.width of each view as you may require.