2
私はitemdecoratorクラスを実装していますが、右から最後のビューを切り捨てますこれは感謝します。 Recycler View - 最後の1つを右から切り取ったアイテム
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