Android image loading and caching open source framework: Android Glide

Android Glide is an open source third-party framework for image loading and caching. Android Glide has implemented a caching strategy internally, so that developers can get rid of the trivial tasks of Android image loading and focus on the code of logical business. Android Glide is easy to use, and with just a few lines of simple and clear code, it can complete most of the functional requirements for loading and displaying images from the network (or local).

To use Android Glide, you need to download the Android Glide library first. The Android Glide project homepage on github:
https://github.com/bumptech/glide

compile files('src/main/libs/glide-3.6.0.jar.jar')

Or add dependencies directly in app/build.gradle file:

compile 'com.github.bumptech.glide:glide:3.7.0'

The use in the actual project is as follows:

ImageView img = (ImageView) convertView.findViewById(R.id.imageView);  
Glide.with(mActivity).load(img_url).centerCrop()  
/* 
 * 缺省的占位图片,一般可以设置成一个加载中的进度GIF图 
 */  
.placeholder(R.drawable.loading).crossFade().into(img);  

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324683056&siteId=291194637