CustomShapeImageView icon indicating copy to clipboard operation
CustomShapeImageView copied to clipboard

Images show up translucent. Get corrected on going back and opening the screen again

Open ghost opened this issue 11 years ago • 4 comments

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?

ghost avatar Dec 24 '14 20:12 ghost

having the same issue, first loading shows transparent images for some reason :(

kibotu avatar Jan 27 '16 16:01 kibotu

for whatever reason it works like a charm with Glide

kibotu avatar Jan 27 '16 16:01 kibotu

actually this does the trick as well: https://gist.github.com/kibotu/972548c9c36e95452ab7

kibotu avatar Jan 27 '16 17:01 kibotu

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.

HGyllensvard avatar Oct 17 '17 16:10 HGyllensvard