答案 0 :(得分:1)
编辑:我删除了错误的答案,这个完美无缺。
您需要创建以下类(如果您在一个活动中使用它,它可以是内部类)。
public class OverlapDecoration extends RecyclerView.ItemDecoration {
private final static int horizontalOverlap = -100;
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
final int itemPosition = parent.getChildAdapterPosition(view);
if (itemPosition == 0) { return; }
outRect.set(horizontalOverlap, 0, 0, 0);
}
}
然后将物品装饰添加到recyclerView。
mRecyclerView.addItemDecoration(new OverlapDecoration());