Picasso图片库缓存

来源:互联网 发布:英雄古达剧情知乎 编辑:程序博客网 时间:2024/05/22 12:53

使用方法非常简单就一句话

Picasso.with(context).load("http://i.imgur.com/DvpvklR.png").into(imageView); 
点击下载Picasso的Jar文件

Picasso.with(context).load("http://i.imgur.com/DvpvklR.png").into(imageView)的过程:

public static Picasso with(Context context) {          if (singleton == null) {              singleton = new Builder(context).build();          }          return singleton;      }            public Picasso build() {              Context context = this.context;                if (downloader == null) {                  downloader = Utils.createDefaultDownloader(context);              }              if (cache == null) {                  cache = new LruCache(context);              }              if (service == null) {                  service = new PicassoExecutorService();              }              if (transformer == null) {                  transformer = RequestTransformer.IDENTITY;              }                Stats stats = new Stats(cache);                Dispatcher dispatcher = new Dispatcher(context, service, HANDLER,                      downloader, cache, stats);                return new Picasso(context, dispatcher, cache, listener,                      transformer, stats, debugging);          }  



0 0
原创粉丝点击