recyclerview.addItemDecoration(new RecyclerView.ItemDecoration() {
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
super.getItemOffsets(outRect, view, parent, state);
int childPosition=parent.getChildAdapterPosition(view);
int last=parent.getAdapter().getItemCount()-1;
if (childPosition==last){
outRect.bottom=0;
}else {
outRect.bottom=5;
}
}
});
老是忘记做个记录!