Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to resize ImageView placeholder with picasso

Picasso allows me to resize an image. Is there a mechanism for resizing the placeholder? The following is not sufficient. What am I missing?

Picasso.with(mContext).load(url).placeholder(R.drawable.imageview_holder).resize(200, 200).into(imageview);
like image 921
Katedral Pillon Avatar asked Sep 30 '14 19:09

Katedral Pillon


People also ask

How do you resize a picture on Picasso?

Image Resizing with resize(x, y) This will resize the image before displaying it in the ImageView .

How do you add a placeHolder in Picasso?

Just call . placeHolder() with a reference to a drawable (resource) and Picasso will display that as a placeholder until your actual image is ready.

How do you load an image into an ImageView from an image URL using Picasso?

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.


1 Answers

What I found that works for me is to resize the placeholder (and error image) directly with the ImageView using android:scaleType="fitCenter" in the XML. Then I can still use Picasso to resize and center the downloaded image.

like image 160
NightSkyDev Avatar answered Sep 22 '22 05:09

NightSkyDev