Open ghost opened 9 years ago
having the same issue, first loading shows transparent images for some reason :(
for whatever reason it works like a charm with Glide
actually this does the trick as well: https://gist.github.com/kibotu/972548c9c36e95452ab7
This is something I just experienced as well when using:
Picasso.load(resId).error(fallback).into(theImageView)
Not sure why, but this is a workaround for now:
Target target = new Target() {
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
imageView.setImageBitmap(bitmap);
}
@Override
public void onBitmapFailed(Drawable errorDrawable) {
imageView.setImageDrawable(errorDrawable);
}
@Override
public void onPrepareLoad(Drawable placeHolderDrawable) {
}
};
imageView.setTag(target);
loadLocalFile(path).error(fallback).into(target);
Note that the setTag is done because Picasso only got a weak reference to the Target, so this will make sure it is not garbage collected while loading in the image in the background.
When the grid/list is created for the first time and images loaded into the image view via Picasso's lazy loading library, the images show up translucent. I set a placeholder image by default for all the image views and then lazy load the downloaded images into the same image view.
If I go back to the previous screen and open the screen again, all images show up correctly.
Am I doing anything wrong by setting a default placeholder image? Or is the lazy loading library - Picasso causing this?