What I'm trying to do:
I'm trying to create a staggered grid layout that takes items with varying width and height. The layout dynamically moves items around so they don't overlap.
What I have tried:
I looked into using the default StaggeredGridLayoutManager, but it appears to only work in one orientation (i.e. Vertical or Horizontal). Furthermore, every library or tutorial I've come across also only deals with items containing either a dynamic height or dynamic width, but not both.
Is there a way to make the StaggeredGridLayoutManager dynamically span both vertically and horizontally? Or will I have to create my own custom layout manager? If the latter, could someone point me in the right direction to learn about how one would create such a layout manager?
Instead of
StaggeredGridLayoutManager,GridLayoutManagercan be used withspanSizeLookup. UsingspanSizeLookup, we can specify the column span.While creating the GridLayoutManager , specify the max no of columns like this
The row span can be applied by calculating the height using the spanning factor and height of the parent