我为这样的项目设置了负余量: -
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;
}
}
这会导致顶部项目在最重要项目重叠之后堆叠最低项目和下一项目。我希望顶级项目与下一个项目重叠,依此类推。