Glide快速入门

作者的github地址

GitHub:https://github.com/bumptech/glide

1.添加依赖

1
2
3
4
5
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.添加网络权限

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

3.使用

简单使用

1
2
3
4
5
@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() 加载到那个控件上