It is necessary to solve the problem of displaying pictures that have not yet loaded. I implement one application using CardView . Each element is a layout with an ImageView .

I would like to see the silhouette of a picture or at least a white square equal to the size of the picture, the size of the picture is previously known, it is also necessary that the picture be the full width of one card (Element), and the height was chosen proportionally.

How can this thing be realized, maybe there are ready-made solutions, or maybe I am doing something wrong or do not understand.

  • ready-made solution - Pacasso library can work with placeholder (stub image) and a lot more useful - pavlofff
  • @pavlofff and how to specify a placeholder height and width, and that he adapted to the width? - Ivan Surkov

1 answer 1

You can use Glide or Picasso to upload images. Personally, I am a supporter of Glide, because with memory, it is better managed and the quality of the pictures is also better. To display something before the picture is loaded, I advise you to put either a white image or any other image on the ImageView background. When the photo is loaded, the static picture is replaced with the loaded one.

  • Thanks for looking at these options, in general, I think I will use Picasso. - Ivan Surkov