I have been trying to add margin using item decoration in recyclerview item in gridlayout manager.
override fun getItemOffsets(
outRect: Rect,
view: View,
parent: RecyclerView,
state: RecyclerView.State
) {
outRect.set(10,10,10,10)
}
but it's not adding margin to the items What could be the possible reasons that it's not adding margin to grid items?
Try setting the margin individually like this.
also add
clipToPadding="false"
in the XML of the recyclerView