1

I'm using FlexboxLayoutManager.

How to change space between rows, and space between items on the first row? enter image description here

class FlexboxLayoutManagerImpl(context: Context, flexDirection: Int) :
    FlexboxLayoutManager(context, flexDirection) {

    override fun generateLayoutParams(lp: ViewGroup.LayoutParams): RecyclerView.LayoutParams {
        return LayoutParams(lp)
    }
}

And call from my adapter:

contentParent.getChildAt(i).setOnClickListener(v1 -> {
     FlexboxLayoutManagerImpl flexboxLayoutManager = new FlexboxLayoutManagerImpl(context, FlexDirection.ROW);
     holder.recycleListView.setLayoutManager(flexboxLayoutManager);
});
Slava
  • 443
  • 4
  • 12
  • Is that change your RecycleView holder view margin complex requirements? – shuabing Aug 18 '23 at 09:15
  • layout_marginTop only apples space on recycleview top, not between rows – Slava Aug 18 '23 at 09:46
  • I found the solution. For space between items I made separate recycleview and special adapter, but for space between rows, it was top margin of cardview. – Slava Aug 18 '23 at 09:53

0 Answers0