给Recyclerview中item设置间距
自定义间距类
public class SpacesItemDecoration extends RecyclerView.ItemDecoration {
private final int space;
public SpacesItemDecoration(int space) {
this.space = space;
}
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
outRect.bottom = space; //设置底部间距
// outRect.left = space; //设置左边间距
// outRect.ri
共有 0 条评论