作者的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.添加網(wǎng)絡(luò)權(quán)限
<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() 加載到那個控件上