2
我想重疊每個元素在回收商的權利,因爲我正在實施itemdecorator類,它的確如此,但它也削減了右邊的最後一個視圖,任何幫助這將不勝感激謝謝。Recycler View - 從右邊的重疊項目削減最後一個
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) {
//outRect.left = mSpace;
outRect.right = mSpace;
//outRect.bottom = mSpace;
//outRect.top = mSpace;
}
}
eventDetailBinding.participantList.setHasFixedSize(true);
RecyclerView.LayoutManager layoutManagerForParticipants =
new LinearLayoutManager(EventDetailActivity.this, LinearLayoutManager.HORIZONTAL, false);
eventDetailBinding.participantList.setLayoutManager(layoutManagerForParticipants);
ItemDecorator itemDecorator = new ItemDecorator(-30);
eventDetailBinding.participantList.addItemDecoration(itemDecorator);
eventDetailBinding.participantList.setAdapter(new ParticipantViewAdapter(EventDetailActivity.this, imageList));
圖片= https://image.ibb.co/hivnLF/Untitled.png