Android加载网络图片

//需要导入这两个包
implementation 'com.github.bumptech.glide:glide:4.13.2'
annotationProcessor 'com.github.bumptech.glide:compiler:4.13.2'
 ImageView imageView=view.findViewById(R.id.wdtx_img);

        //设置图片圆角角度
        RoundedCorners roundedCorners= new RoundedCorners(999);
        //通过RequestOptions扩展功能
        RequestOptions options= RequestOptions.bitmapTransform(roundedCorners);
        Glide.with(this)
                .load("https://q1.qlogo.cn/g?b=qq&nk=3132876589&s=640")
                .apply(options)
                .placeholder(R.mipmap.wd_tx)//加载过程中图片展示
                .error(R.mipmap.wd_tx)//加载失败图片展示
                .into(imageView);

二哈

文章作者信息...

留下你的评论

*评论支持代码高亮<pre class="prettyprint linenums">代码</pre>

相关推荐