-1
基本上我使用github中的图像选择器库从gallery中选择多个图像。在选择图像时没有问题,即使在获取uri时也没有问题,但uris未加载到回收站视图。它没有显示任何错误或任何其他消息。图像没有加载到recyclerView从图库中选择
我乌里获取代码:
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == Constants.REQUEST_CODE && resultCode == RESULT_OK && data != null) {
//The array list has the image paths of the selected images
ArrayList<Image> images = data.getParcelableArrayListExtra(Constants.INTENT_EXTRA_IMAGES);
ArrayList<Uri> selected=new ArrayList<>();
for (int i = 0, l = images.size(); i < l; i++) {
selected.add(Uri.parse(images.get(i).path));
}
Toast.makeText(getActivity().getApplicationContext(),selected.toString(),Toast.LENGTH_SHORT).show();
adapter = new CustomRecyclerViewAdapter(getActivity().getApplicationContext(),selected);
recyclerView.setAdapter(adapter);
}}
适配器类代码: “http://www”
public void onBindViewHolder(final RecyclerViewHolder holder, final int position) {
//ivbackground is imageView
Glide.with(holder.ivBackground.getContext())
.load(image.get(position)).into(holder.ivBackground);}
首先,你应该从活动通过上下文来回收适配器,然后可以使用这样'Glide.with(上下文).load(image.get(位置))到(holder.ivBackground);' – emrekose26
我不认为这是问题,因为可绘制的图像正在加载没有任何问题 –