I'm having an issue while populating a recycler view with a GridLayoutManager.
I need to fulfill the first row, and after this is complete, go to the second row. I did an algorithm that reorders the list so it's being shown properly and I can get the item clicked without doing any mapping-unmapping thing. This is working fine, but the trouble appears when all the items can be shown on the screen without scrolling.
For example, I have 4 items and I need to show them in a 2-row grid layout (horizontal layout). The screen has space for 3 items, so I need them to be in the first row, while the 4th item should be the only one in the second row.
To give you a picture of what I have by default:
0 2
1 3
And what I need is:
0 1 2
3
Any ideas?
Edit: As requested, here is the code I'm using:
GridLayoutManager layoutManager = new GridLayoutManager(getContext(),2,LinearLayoutManager.HORIZONTAL, false);