我有一个回收站视图,我希望在单元格之间添加空格。 但是,使用下面的代码可以使用,在中间空间加倍。
如何将它们隔开并避开中间的双重空间?
public class ItemDecorationAlbumColumns extends RecyclerView.ItemDecoration {
private int space;
public ItemDecorationAlbumColumns(int space) {
this.space = space;
}
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
outRect.left = space;
outRect.right = space;
outRect.bottom = space;
// Add top margin only for the first item to avoid double space between items
if(parent.getChildAdapterPosition(view) == 0) {
outRect.top = space;
}
}
}
通话:
recyclerView.addItemDecoration(new ItemDecorationAlbumColumns(50));
答案 0 :(得分:0)
使用以下代码解决:
x = df.pivot(*df.columns)