mikepenz/FastAdapter

Diff items in GridLayout

NetylkinOV opened this issue · 4 comments

Hello mikepenz. Tell me is it possible to do it? Add 2 different items to RecyclerView with GridLayoutManager 2 columns. Check image. Thank you :)

example

Hi mikepenz, thank you so much for your help. The short answer is:

val gridLayoutManager = GridLayoutManager (this, 3)
         gridLayoutManager.spanSizeLookup = object: GridLayoutManager.SpanSizeLookup () {
             override fun getSpanSize (position: Int): Int {
                 return when (fastItemAdapter.getItemViewType (position)) {
                     R.id.fastadapter_expandable_item_id -> 3
                     R.id.fastadapter_icon_item_id -> 1
                     else -> -1
                 }
             }
         }

As I don't need an implementation with Expandable.
I have been using your library for several years now, it's amazing how powerful it is.

I'm still waiting for the multiplatform kotlin version :)))

I wish you health and good luck :)

Happy I could help :) Thanks for the kind words