我想使用fit()方法来实现一个目标,但是它不起作用。还有其他方法可以做到吗?我想要像这样的效果:
Picasso.with(this).load(selectedImage).fit().into(target);
如果您使用fit()方法,目标必须是ImageView。
来自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.
fit()
的唯一方法是将图像加载到(imageView)
中,而不是into(Target)
。 - Miha_x64Picasso.with(this).load(selectedImage).fit().into(target);
改为Picasso.with(this).load(selectedImage).fit().into(imageView);
。别忘了,如果需要的话,你也可以在.fit()
后面直接调用.centerInside()
或.centerCrop()
。 - ban-geoengineering