Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fit cannot be used with a Target Picasso Android

I want to use fit() with a target. But it won't let me. What can i do else? I want to do something like this:

Picasso.with(this).load(selectedImage).fit().into(target);
like image 799
Shahryar Avatar asked Oct 15 '25 16:10

Shahryar


1 Answers

If you are using fit() your target must be an ImageView.

From the javadoc:http://square.github.io/picasso/2.x/picasso/com/squareup/picasso/RequestCreator.html#fit--

public RequestCreator fit()

Attempt to resize the image to fit exactly into the target ImageView's bounds. 
This will result in delayed execution of the request until the ImageView has been
laid out.

Note: This method works only when your target is an ImageView.
like image 138
isma3l Avatar answered Oct 18 '25 07:10

isma3l



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!