作者的github地址
GitHub:https://github.com/bumptech/glide
1.添加依赖
dependencies {
compile 'com.github.bumptech.glide:glide:4.0.0-RC0'
compile 'com.android.support:support-v4:25.3.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0-RC0'
}
2.添加网络权限
<uses-permission android:name="android.permission.INTERNET"/>
3.使用
简单使用
@Override
public void onCreate(Bundle savedInstanceState) {
ImageView imageView = (ImageView)findViewById(R.id.my_image_view);
GlideApp.with(this).load("https://www.baidu.com/img/bd_logo1.png").into(imageView);
}
.with(this) 上下文
.load() 加载的图片地址
.into() 加载到那个控件上