问题
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
回答1:
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.
来源:https://stackoverflow.com/questions/42602491/how-to-create-this-layout-with-a-recyclerview