Android. StaggeredGridLayoutManager gapStrategy makes View invisible

69 views Asked by At

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

0

There are 0 answers