一、
Picasso
gradle依赖:
compile'com.squareup.picasso:picasso:2.5.2'
使用非常简单:
Picasso.with(this).load("").error(R.mipmap.ic_launcher). placeholder(R.mipmap.ic_launcher). resize(50, 50).config(Bitmap.Config.ARGB_8888). memoryPolicy(MemoryPolicy.NO_CACHE, MemoryPolicy.NO_STORE). networkPolicy(NetworkPolicy.NO_CACHE). centerInside().into(iv);
二、Glide(支持gif)用法跟picasso差不多
studio添加依赖:
repositories {
mavenCentral() // jcenter() works as well because it pulls from Maven Central
}
dependencies {
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.android.support:support-v4:19.1.0'
}
mavenCentral() // jcenter() works as well because it pulls from Maven Central
}
dependencies {
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.android.support:support-v4:19.1.0'
}
使用:跟Picasso类
Glide.with(this).load("file://...."). placeholder(R.mipmap.ic_launcher).error(R.mipmap.ic_launcher).//占位图/加载错误 override(50,50).//指定他显示宽高 skipMemoryCache(false).//内存缓存 diskCacheStrategy(DiskCacheStrategy.NONE).//缓存原尺寸和各种尺寸 centerCrop().//显示方式/fitCenter into(imageView);
(一)GlideTransformation 基于Glide的图片处理,支持各种图片样式
使用: