1

I need to implement several views in the same recycler view, with different width and height size, take a look at this image

Sometimes I will need to paint a item that takes two colums, as the first item in the image, I already can do this with this:

 layoutManager.spanSizeLookup = object : SpanSizeLookup() {
        override fun getSpanSize(position: Int): Int {
            return if (twoColumns.contains(position)) 2 else 1
        }
    }

But I also have to do something like the item 6, that takes two rows and one column and currently I cannot do that, I tried with this library, and also with FlexboxLayoutManager, and I can't achieve that.

Is there another layout manager that fit better to my approach, or any library?

2
  • You can use StaggeredGridLayoutManager, but you will still need to calculate and set the height manually for items to take its place as in the image. Commented Apr 29, 2022 at 4:12
  • Found any solution ?? Commented Jul 11, 2022 at 15:52

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.