LayoutManager for RecyclerView with different items width

Viewed 1818

I have a RecyclerView and I used StaggeredGridLayoutManager for its layout manager. Every item has different width and I don't know how wide is every item.
My code:

StaggeredGridLayoutManager stagedLayoutManager = new StaggeredGridLayoutManager(4, VERTICAL);
recyclerView.setLayoutManager(stagedLayoutManager);

The result is some thing looks like this: enter image description here

But I want to have some thing looks like this one:enter image description here

Please guid me how can I achieve this purpose? Thanks

1 Answers
Related