Picasso和Glide加载图片--简单用法

2019-05-24  本文已影响0人  旺旺碎冰冰s

第一步:加权限


<uses-permission android:name="android.permission.INTERNET">

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

第二步:导入库


compile'com.github.bumptech.glide:glide:3.5.2'ImageView imageView = findViewById(R.id.iv_img);

compile'com.squareup.picasso:picasso:2.5.2'

第三步:


ImageView picassoView = findViewById(R.id.picasso_img);

Glide.with(this).load("https://gss1.bdstatic.com/-vo3dSag_xI4khGkpoWK1HF6hhy/baike/w%3D480/sign=bd524a00ab4bd11304cdb63a6aaea488/8601a18b87d6277febe89c4b2e381f30e824fccf.jpg").into(imageView);

Picasso.with(this).load("https://gss1.bdstatic.com/-vo3dSag_xI4khGkpoWK1HF6hhy/baike/w%3D480/sign=bd524a00ab4bd11304cdb63a6aaea488/8601a18b87d6277febe89c4b2e381f30e824fccf.jpg").into(picassoView);

两者区别总结:

1.Picasso第一次的加载速度比Glide快,如果是从内存里拿图片,Glide比Picasso快。

2.Glide可以加载动图,Picasso不能。

3.Glide的jar库比Picasso大很多。(Picasso 的方法 总共有849个,而 Glide 的有2678个)

上一篇下一篇

猜你喜欢

热点阅读