Picture is not complete
Picture is not complete
Download the picture sometimes is not complete
Which version do you use? (你使用哪个版本?) How do you load the image? (你如何加载的形象呢?) Is there an Exception in LogCat? (是否有LogCat Exception?)
ivHd.getLayoutParams().width = Device.getWidth();
ivHd.getLayoutParams().height = Device.getWidth()*15/32;
Glide.with(WeiBoListNewActivity.this).load(hd.ImageUrl).placeholder(R.color.guidColor).error(R.color.guidColor)
.override(Device.getWidth(), Device.getWidth()*15/32)
.crossFade().diskCacheStrategy(DiskCacheStrategy.SOURCE).centerCrop()
.transform(new BitmapTransformation(WeiBoListNewActivity.this) {
@Override
public String getId() {
return Device.getMD5String(hd.ImageUrl);
}
@Override
protected Bitmap transform(BitmapPool arg0, Bitmap source, int arg2, int arg3) {
x = source.getWidth();
y = source.getHeight();
return source;
}
})
.listener(new RequestListener<Object, GlideDrawable>() {
@Override
public boolean onException(Exception arg0, Object arg1,
Target<GlideDrawable> arg2, boolean arg3) {
return false;
}
@Override
public boolean onResourceReady(GlideDrawable arg0, Object arg1,
Target<GlideDrawable> arg2, boolean arg3, boolean arg4) {
if(x >0 && y>0) {
setXY(x, y);
LinearLayout.LayoutParams a = new LinearLayout.LayoutParams(Device.getWidth(), Device.getWidth()*y/x);
ivHd.setLayoutParams(a);
Glide.with(WeiBoListNewActivity.this).load(hd.ImageUrl).placeholder(R.color.guidColor).error(R.color.guidColor)
.override(Device.getWidth(), Device.getWidth()*y/x)
.crossFade().diskCacheStrategy(DiskCacheStrategy.SOURCE).centerCrop()
.into(ivHd);
} else {
int x1 = 32, y1 = 15;
if(getX()>0 && getY()>0) {
x1 = getX();
y1 = getY();
}
ivHd.getLayoutParams().width = Device.getWidth();
ivHd.getLayoutParams().height = Device.getWidth()*y1/x1;
Glide.with(WeiBoListNewActivity.this).load(hd.ImageUrl).placeholder(R.color.guidColor).error(R.color.guidColor)
.override(Device.getWidth(), Device.getWidth()*y1/x1)
.crossFade().diskCacheStrategy(DiskCacheStrategy.SOURCE).centerCrop()
.into(ivHd);
}
return true;
}
})
.into(ivHd);
At first I did not know the size of the picture, get the size of the download is complete, and then reloaded into imageview in
If you're referring to a partial image, it may have been fixed here: https://github.com/bumptech/glide/commit/64be9d314814f541fe1bb20553c7501d6e8c987b#diff-a5c571a05a090ccc55c81f4af74be5cf.
Try the latest Snapshot and see if you can still reproduce.
thank you

This problem is likely to occur twice in a row to perform downloads