Glide 网络加载图片的框架
添加依赖: implementation 'com.github.bumptech.glide:glide:3.7.0' 使用方法: Glide . with ( context ) . load ( show_url ) //需要加载的图片url // .crossFade()//过渡动画 . dontAnimate () //关闭动画 . fitCenter () //图片与控件的适配 . diskCacheStrategy ( DiskCacheStrategy . SOURCE ) //缓存策略为:原始缓存 . placeholder ( R . drawable . picture_demo ) //加载过程显示的图片 . error ( R . drawable . picture_demo ) //加载失败显示的图片 . listener ( new RequestListener < String , GlideDrawable >() { //设置监听器 @Override public boolean onException ( Exception e , String model , Target < GlideDrawable > target , boolean isFirstResource ) { //返回错误时 return false ; }