42.图片控件加载网络GIF动态图
1.下载素材。
本节没有素材,如有素材,请公众号内获取。
2.添加依赖。
implementation 'com.github.bumptech.glide:glide:4.11.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
3.在MainActivity中设置。
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ImageView imageView = findViewById(R.id.image_show);
Glide
.with(this)
.load("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1590926743708&di=3d360072914a3bde243e76bd3e9b2606&imgtype=0&src=http%3A%2F%2Fimg.youai123.com%2F1507617001-7439.gif")
.centerCrop()
.into(imageView);
}
}