Fork me on GitHub

(Android图片内存优化)Picasso加载图片 教程。。详细版

Picasso 是 Android 上一个强大的图片下载和缓存库。

Debug ribbon indicators


示例代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Picasso.with(context).load("http://i.imgur.com/DvpvklR.png").into(imageView);
 
@Override public void getView(int position, View convertView, ViewGroup parent) {
  SquaredImageView view = (SquaredImageView) convertView;
  if (view == null) {
    view = new SquaredImageView(context);
  }
  String url = getItem(position);
 
  Picasso.with(context).load(url).into(view);
}
 
//图像处理
Picasso.with(context)
  .load(url)
  .resize(5050)
  .centerCrop()
  .into(imageView)
posted @ 2016-01-19 10:29  程序员小冰  阅读(373)  评论(0编辑  收藏  举报


Fork me on GitHub