Recyclerview - 顶部项目应与下一个项目重叠,依此类推

时间:2015-10-02 11:19:15

标签: java android android-recyclerview

我为这样的项目设置了负余量: -

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

这会导致顶部项目在最重要项目重叠之后堆叠最低项目和下一项目。我希望顶级项目与下一个项目重叠,依此类推。

0 个答案:

没有答案