I have this method in ItemDecoration class for recyclerView -
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
outRect.left = space;
outRect.right = space;
outRect.bottom = space;
// Add top margin only for the first item to avoid double space between items
if(parent.getChildPosition(view) == 0)
outRect.top = space;
}
Is there any way to change the color of output outRect like redrawing it or something ?
view.setBackground()
? – Canova