[英]Failed to load image using glide
In my application, I was trying to get the thumbnail of a book from google play books API and display it in an image view but somehow what I did is not working.在我的应用程序中,我试图从 google play books API 获取一本书的缩略图并将其显示在图像视图中,但不知何故我所做的不起作用。
Glide.with(holder.thumb.getContext())
.load(curThumb)
.into(holder.thumb);
when I used the above method with a local image it worked also thumbnail URL is correct当我将上述方法与本地图像一起使用时,它也有效缩略图 URL 是正确的
I tried using Glide v4.0.0-RC1 use RequestOptions to add the placeholder, error image and other options make sure URL(image_url) starts with https, not with HTTP我尝试使用 Glide v4.0.0-RC1 使用 RequestOptions 添加占位符、错误图像和其他选项确保 URL(image_url) 以 https 开头,而不是 HTTP
RequestOptions options = new RequestOptions()
.centerCrop()
.placeholder(R.mipmap.ic_launcher_round)
.error(R.drawable.your_error_image);
RequestOptions to add placeholder, error image and to customize image RequestOptions 添加占位符、错误图像和自定义图像
Glide.with(this).load(image_url).apply(options).into(imageView);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.