1

I use a RecyclerView to show 2 column layout with some items as sections, using the full width. This is how I am setting up my RecyclerView:

fun bindRV() {
    val layoutManager = StaggeredGridLayoutManager(2, RecyclerView.VERTICAL)
    layoutManager.gapStrategy = StaggeredGridLayoutManager.GAP_HANDLING_NONE
    recyclerViewServicesBlock.layoutManager = layoutManager
    serviceBlockAdapter.items = serviceViewModel.getServiceBlockItems()
    recyclerViewServicesBlock.adapter = serviceBlockAdapter
}

When I set gapStrategy to GAP_HANDLING_NONE items not showing. For example, I expect in the left column: A, C, E, G, in the right column: B, D, F, H; but I have this example.

I am trying to set gap strategy first then bind the adapter and vice versa

Rafael
  • 11
  • 3
  • You may want to specify a question. Otherwise people might find it difficult to give you an answer. – Krokomot May 20 '23 at 02:25
  • @Krokomot where exactly to indicate what may not be clear – Rafael May 26 '23 at 11:09
  • In the whole everything's fine. Sorry, I should have said it another way -- It's preferable to formulate an explicit question a la "How could ..." instead of just stating "I'm trying to ...". That will improve your chances for a proper answer. – Krokomot May 26 '23 at 18:44

0 Answers0