Search code examples
androidpicassoandroid-glide

Glide not loading image without placeholder


I'm trying to load an image using Glide:

case "image":
    Log.d("TRecyViewAdapter", "Got Image");
    ImageView imageView = new ImageView(context);
    imageView.setLayoutParams(new    GridLayoutManager.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.MATCH_PARENT
    ));
    contents.addView(imageView);
    Glide.with(context).load(part.getContent()).into(imageView);
    break;

It's showing nothing.

However if I change that last line to Picasso:

    Picasso.with(context).load(part.getContent()).into(imageView);

Image loads at full size just as I was expecting.

Also. If I use Glide with a placeholder:

    Glide.with(context).load(part.getContent()).placeholder(R.mipmap.def_avatar).into(imageView);

It loads the image but in a very small size (the size of R.mipmap.def_avatar)

I want to be able to load the real size image without having to specify placeholders (its a dynamic view and its supposed to show a lot of different images with different sizes and so)

I want to use Glide instead of Picasso because I want support for animated gifs.


Solution

  • Looks like adding override does the trick. Image is now loading as expected.

    Glide.with(context).load(part.getContent()).override(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL).into(imageView);