答案 0 :(得分:0)
您可以如下使用StaggeredGridLayout。
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
StaggeredGridLayoutManager staggeredGridLayoutManager = new StaggeredGridLayoutManager(3, LinearLayoutManager.VERTICAL);
recyclerView.setLayoutManager(staggeredGridLayoutManager);
CustomAdapter customAdapter = new CustomAdapter(MainActivity.this,images);
recyclerView.setAdapter(customAdapter);
答案 1 :(得分:0)
I have managed span of images in adapter class like below.
private static final int TYPE_SMALL_SQUARE = 0;
private static final int TYPE_LARGE_SQUARE = 1;
private static final int TYPE_LREACT = 2;
private static final int TYPE_HREACT = 3;
@Override
public int getItemViewType(int position) {
switch (position) {
case 0:
return TYPE_LARGE_SQUARE;
case 1:
return TYPE_HREACT;
case 2:
return TYPE_LREACT;
case 3:
return TYPE_LREACT;
case 4:
return TYPE_SMALL_SQUARE;
}
return super.getItemViewType(position);
}
答案 2 :(得分:0)
import os, shutil, time
if not os.path.exists(dirName):
os.mkdir(dirName)
print("Directory " , dirName , " Created ")
else:
print("Directory " , dirName , " already exists")
def copyFile(src, dest):
try:
shutil.copy(src, dest)
# eg. src and dest are the same file
except shutil.Error as e:
print('Error: %s' % e)
# eg. source or destination doesn't exist
except IOError as e:
print('Error: %s' % e.strerror)
os.rename("path/to/current/age.csv", "path/to/new/destination/for/age.csv")
shutil.move("path/to/current/age.csv", "path/to/new/destination/for/age.csv")