GtR
0
Q:

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        }    }}
1

New to Communities?

Join the community