recycler view margin code example
Example: margin recyclerview android
class MarginItemDecoration(private val spaceHeight: Int) : RecyclerView.ItemDecoration() { override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, state: RecyclerView.State) { with(outRect) { if (parent.getChildAdapterPosition(view) == 0) { top = spaceHeight } left = spaceHeight right = spaceHeight bottom = spaceHeight } }}