我正在尝试从图库中将图片,视频和屏幕截图加载到RecyclerView
。单击RecyclerView
项时需要使用listselector突出显示并需要获取所选路径的列表。可以任何人建议这样做。如下图所示:
答案 0 :(得分:1)
对于多个图像选择器,请点击此链接 DroidNinja Filepicker
制作适配器和POJO类以在RecycelrView上查看所选照片
public void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case FilePickerConst.REQUEST_CODE_PHOTO:
if (resultCode == Activity.RESULT_OK && data != null) {
filePaths.addAll(data.getStringArrayListExtra(FilePickerConst.KEY_SELECTED_PHOTOS));
Image img;
ArrayList<Image> images = new ArrayList<>();
try {
for (String path : filePaths) {
img = new Image();
img.setUri(Uri.fromFile(new File(path)));
Log.e("VIDEO", Uri.fromFile(new File(path)) + "");
images.add(img);
}
rvPhoto.setAdapter(new MyAdapter(this, images));
} catch (Exception e) {
e.printStackTrace();
}
}
break;
}