http://www.cnblogs.com/whoislcj/p/5558168.html这篇文章写得很详细,我这里简单说一些
1.app的build.gradle的dependencies里面添加
compile 'com.github.bumptech.glide:glide:4.1.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.1.1'
2.在项目的build.gradle的dependencies里面添加
allprojects { repositories { jcenter() mavenCentral() maven { url 'https://maven.google.com' } } }
3.使用
public class MainActivity extends AppCompatActivity { String picUrl = "http://img3.redocn.com/tupian/20150312/haixinghezhenzhubeikeshiliangbeijing_3937174.jpg"; private ImageView imageView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); imageView = (ImageView) findViewById(R.id.image); // Glide.with(this).load(picUrl).into(imageView);//加载网络图片 Glide.with(this).load(R.drawable.ic_launcher).into(imageView);//加载本地图片 } }