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 spinning progress bar style spinner that animates around and around while the image is loading, like I see in most professional apps. Picasso doesn't seem to support this, only static image drawables. Is there a way to get it working with Picasso or do I have to do something different?
Picasso.with(context).load(url)
.placeholder(R.drawable.loading)
.error(R.drawable.image_download_error)
.into(view);
Just use Picasso PlaceHolder
I found answer to this question!
See: https://github.com/square/picasso/issues/427#issuecomment-266276253
In addition to answer of @DBragion, try below.
Now we can fix height and width!
I think there are two key points.
use noFade()
set image_view's scaleType to "CENTER_INSIDE"
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