文章导读
大家好,我是苏承栈。今天咱们来聊聊Android开发中图片加载的神器——Glide。无论是加载网络图片还是下载图片,Glide都能轻松搞定。跟着我,一起探索Glide的强大功能吧!
一、Glide简介
Glide真的太方便了,一句话概括就是:简单、高效。它可以帮助我们轻松加载图片,节省大量时间。GitHub地址:[Glide](https://github.com/bumptech/glide)
二、加载网络图片到ImageView
Glide.with(v).load(picUrl).placeholder(R.mipmap.ic_loading).error(R.mipmap.ic_load_failure).into(ivPic);
placeholder:图片加载时,这里可以设置一个占位图。
error:图片加载失败时,这里可以设置一个错误图。
into:指定加载图片的控件。
三、下载网络图片到本地
new Thread() {
@Override
public void run() {
super.run();
try {
String picUrl =
