首页 > 解决方案 > 使用 glide 从 firebase 获取图像并设置为回收器视图但图像未加载

问题描述

使用滑翔从火力基地获取图像并设置为回收器视图但图像未加载

upload uploadCurrent = mUploads.get(position);
Glide.with(mContext).load(uploadCurrent.getFilePathUri()).into(holder.mimageView);
holder.textViewname.setText(uploadCurrent.getProductName());
holder.textViewcontact.setText(uploadCurrent.getContactNumber());
holder.textViewprice.setText(uploadCurrent.getPrice());

标签: androidfirebaseandroid-recyclerviewandroid-glide

解决方案


你可以用毕加索代替滑翔,

在您的 build.gradle 应用程序中

compile 'com.squareup.picasso:picasso:2.5.2'

然后

Picasso.with(mContext).load(uploadCurrent.getFilePathUri()).into(holder.mimageView);

如果它不起作用,请尝试确保uploadCurrent.getFilePathUri()返回有效的 uri。

如果它返回一个有效的 uri,那么问题出在上下文可能尝试

Picasso.with(getApplicationContext()).load(uploadCurrent.getFilePathUri()).into(holder.mimageView);

如果仍然没有运气,那么最好的方法是删除毕加索并滑行并书写

holder.imageView.setImageUri(uploadCurrent.getFilePathUri());

而已。


推荐阅读