I have set the negative margin for items like this:-
public class ItemDecorator extends RecyclerView.ItemDecoration {
private final int mSpace;
public ItemDecorator(int space) {
this.mSpace = space;
}
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
int position = parent.getChildAdapterPosition(view);
if (position != 0)
outRect.top = mSpace;
}
}
This causes top item to stack lowest and next item after the top item overlaps it. I want top item to overlap its next item and so on.