Android Glide placeholder size

后端 未结 4 634
醉话见心
醉话见心 2021-01-07 23:25

I have a problem with Android Glide. I am trying to quickly swap my image, they just become all placeholder size, and my placeholder image is very low size. So what I need t

4条回答
  •  鱼传尺愫
    2021-01-08 00:00

    If I correctly understand your problem, you need to load images, but they must have width and height bigger than your placeholder image. To solve your problem you first should read documentation for Glide. I can't see your ImageView definition in the xml file, but i think that you use wrap_content attribute for width and height. If I am right there is your bottleneck. Before image loading is started, Glide gets exact ImageView width and height. After that it loads image from the network and at the same time resize it according to the one of the ImageView attributes(width or height). Thats why you get small images after loading. To solve your problem just set width or height of the ImageView in value that you expect to see. Other side of the image will be automatically calculated by the Glide logic.

提交回复
热议问题