Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create this layout with a RecyclerView?

I'm trying to create a recycler view with this type of layout. The items are strings and can apear with diferent sizes, i dont know how much items there will be in each row. Can I do this with a StaggeredGridLayoutManager? The image is just a fake example, there can be more items in each row

description

like image 382
xanexpt Avatar asked Jan 19 '26 02:01

xanexpt


1 Answers

You might wanna check out the open-source FlexboxLayout, developed by Google, especially FlexboxLayoutManager which is a layout manager for a RecyclerView.

To create the layout manager with the right config, just do this:

FlexboxLayoutManager layoutManager = new FlexboxLayoutManager();
layoutManager.setFlexWrap(FlexWrap.WRAP);

For more information, check out the Android Developers Blog's post.

like image 200
Gergely Kőrössy Avatar answered Jan 20 '26 16:01

Gergely Kőrössy