Animated loading image in picasso

后端 未结 10 1603
醉酒成梦
醉酒成梦 2020-11-28 19:10

I have the following code to load an image in Picasso, using a drawable for the placeholder to display while the image is downloading. What I want though is an animated spin

10条回答
  •  情深已故
    2020-11-28 19:28

    Picasso doesn't support animated placeholders unfortunately.

    One way you could work around this is to place your ImageView in a FrameLayout with the animated drawable underneath. This way when Picasso loads the image it will load over the top of the animated placeholder, giving the user the intended effect.

    Alternatively, you could load the image into a Target. Then you'd have the progress bar showing by default, and when the onBitmapLoaded method is called you can hide it and display the image. You can see a basic implementation of this here

提交回复
热议问题