How to make the sizes of every item in a RecyclerView different?

ぐ巨炮叔叔 提交于 2021-02-08 19:52:22

问题


I want to achieve something like this: Google Keep

But here's what I get after trying: My outcome

I already set the height of the layout of the items to WRAP_CONTENT but the result is still the same.

What should I do?


回答1:


For those who are looking for an answer, just use a StaggeredGridLayoutManager as the RecyclerView's layout manager like this:

recycler.setLayoutManager(new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL));


来源:https://stackoverflow.com/questions/33316293/how-to-make-the-sizes-of-every-item-in-a-recyclerview-different

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!