I use GridlayoutManager
and override getSpanSize
method. I was able to implement three and one column in the same recyclerview. But I was not able to implement five columns in the same recyclerview.
CodePudding user response:
If you know which row will have five column and which has three column so you can use below code
GridLayoutManager layoutManager = new GridLayoutManager(this, 3);
layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
if (position > 3)
return 5;
else
return 3;
}
});