0

I need to make panel of some sort with a Staggered Grid behavior such in the photo attached (cells width are not the same in each cell):

enter image description here

I tried normal GridView, I tried StaggeredGridLayoutManager with and without a recycler view, I've searched the internet for so long, and still hasn't found anything that gave me the suitable solution in java.

I also tried with the following answer: LayoutManager for RecyclerView Grid with different cell width and Android Grid view with different width of column (There are many more answers similar to this 2), but I need it to be "dynamic" and what I mean by that is that I need the cell width to be determine by it's content width and not just by it's index like in the answers attached.

Anyone knows a way to accomplish such a thing? or knows a library or a similar project with that feature?

Lidor Eliyahu Shelef
  • 1,299
  • 1
  • 14
  • 35

1 Answers1

0

It looks like https://github.com/google/flexbox-layout may help you.

You can use FlexboxLayoutManager as adapter and play with properties, all the views will wrap automatically depending on their width.

Vasily Kabunov
  • 6,511
  • 13
  • 49
  • 53
  • 1
    You should mark as a duplicate instead of repeating the answer from the duplicate question. – Andrew Apr 20 '22 at 09:10