android - RecyclerView Grid - define number of items per row in -


i'm typically against posting question without code, have no code show. i'm converting project listviews , gridviews recyclerview. in 1 class, use small gridview place items pulled server.

the max number of items per row 3, remainder needs on top. if there's 5 items, top row has 2, bottom has 3. if there's 4 items, top row has 1, bottom has 3.

my google-fu failing me , i'm not able find examples type of customization. if point me in right direction, i'll post completed code find post in future.

thanks all

there constructor of gridlayoutmanager, takes 4 parameters.

new gridlayoutmanager(this, 3, gridlayoutmanager.vertical, true) 

the second 1 spancount, number of columns or rows in grid, while forth called reverselayout , when set true, cells laid out end start .


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -