I'm using a 128x128 circular image, animated by a drawable as a placeholder in Picasso.
<?xml version="1.0" encoding="utf-8"?>
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/loading_circle"
android:pivotX="50%"
android:pivotY="50%" />
And this is how my Java code implements it:
Picasso.with(context)
.load(message.getMediaUrl())
.config(Bitmap.Config.ARGB_4444)
.resize(w, h)
.onlyScaleDown()
.centerCrop()
.placeholder(R.drawable.progresscircle)
.into(messageImage);
Note that the image sizing parameters above are required by the final image that is loaded into my chat adapter's imageview.
The problem is, Picasso is blowing up and cropping the placeholder like this:
How can I set separate parameters for the placeholder to be suitably sized? Also, what exact parameters would be helpful?
You can use a placeholder image by using the *.placeholder(R.drawable.image_name)* in your Picasso call like: Picasso.with(context) .load(imageUrl) .placeholder(R.drawable.image_name) If you want to use a progress bar instead of a placeholder image you can create a callback inside the .into function.
Image Resizing with resize(x, y) This will resize the image before displaying it in the ImageView .
Image loading using Picasso is very easy, you can do it like this way Picasso. get(). load("http://i.imgur.com/DvpvklR.png").into(imageView); and in their website you can get every details. In your case you can parse every image URL and use RecyclerView to show them along with Picasso.
in XML
where you set ImageView
add.
android:scaleType="centerCrop"
It may work. you can set fitXY
instead of centerCrop
if it is not working.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With