Picasso.with(context).load("http://i.imgur.com/DvpvklR.png").into(imageView);处理图像大小:
Picasso.with(context) .load(url) .resize(50, 50) .centerCrop() .into(imageView)自定义特效:
public class CropSquareTransformation implements Transformation { @Override public Bitmap transform(Bitmap source) { int size = Math.min(source.getWidth(), source.getHeight()); int x = (source.getWidth() - size) / 2; int y = (source.getHeight() - size) / 2; Bitmap result = Bitmap.createBitmap(source, x, y, size, size); if (result != source) { source.recycle(); } return result; } @Override public String key() { return "square()"; } }设置图片下载与错误标识:
Picasso.with(context) .load(url) .placeholder(R.drawable.user_placeholder) .error(R.drawable.user_placeholder_error) .into(imageView);支持Resources, assets, files, content providers are all supported 等图片方式
Picasso.with(context).load(R.drawable.landing_screen).into(imageView1); Picasso.with(context).load(new File("/images/oprah_bees.gif")).into(imageView2);开启调试信息
Picasso.with(context).setDebugging(true);更多信息:picasso