Recyclerview - Top item should overlap next item and so on

蓝咒 提交于 2019-12-10 10:00:22

问题


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.

来源:https://stackoverflow.com/questions/32906033/recyclerview-top-item-should-overlap-next-item-and-so-on

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!