RecyclerView horizontal LinearLayoutManager with multiple rows

时间:2016-05-11 11:34:09

标签: java android mobile android-recyclerview

I want to make a Layout Manager that will represent its items in a Tag-Cloud way of representation, just as on the Image below.

enter image description here

There are libraries that do this but I just want to learn how to do it by using the RecyclerView and its LayoutManager pattern. StaggeredGridLayoutManager is out of option because you must specify the number of columns just as for a GridLayoutManager, and what I need in this particular case is make some rows contain 2 items, some 1 and some 3 or more elements. I was thinking of using a LinearLayoutManager with a Horizontal Orientation but instead of making it scrollable horizontaly, I'd need to make it break the elements for which there is no more space in the current row - positioned in a new row. But I have no idea how to do it. Can anyone at least guide me into the basics of the solution?

Thanks.

0 个答案:

没有答案