Woo! Hooy!
We have just recieved your project brief and our expert will contact you shortly.
Send Again
Close
In this blog, We have shown you how to make custom layout manager to make the different span count at the different row in recycler view.
Here, we will show the 2,2,4,4 span count on different columns.
Step 1: make custom adapter,
1 2 3 4 5 6 7 8 9 10 11 |
GridLayoutManager layoutManager = new GridLayoutManager(this, 4); layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() { @Override public int getSpanSize(int position) { if (position > 3) return 1; else return 2; } }); |
Step 2: apply to the recycler view,
1 |
((RecyclerView) childProduct.findViewById(R.id.category_product_rv)).setLayoutManager(layoutManager); |