【问题标题】:RecyclerView with stack item(overlapping)RecyclerView 与堆栈项(重叠)
【发布时间】:2018-06-12 09:49:10
【问题描述】:

我需要回收站视图,其中每个下一个项目低于前一个项目。它应该以某种方式重叠。是否可以使用recyclerview?

【问题讨论】:

标签: android android-recyclerview overlap


【解决方案1】:

所有你需要添加ItemdDecorator:

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);
        outRect.right = -mSpace;
    }
}

然后在初始化回收站视图时:

binding.containerAction.rvGroupCallUserList.addItemDecoration(new ItemDecorator(80));

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-23
    • 1970-01-01
    • 2017-05-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多