public class ImageUtils {
/**
* 加载图片
*/
public static void loadImage(Context context,String url, final ImageView imageView) {
if (imageView == null) return;
Glide.with(context).load(url).diskCacheStrategy(DiskCacheStrategy.ALL).into(imageView);
}
public static void loadImage(Activity activity,String url,final ImageView imageView) {
if (imageView == null) return;
Glide.with(activity).load(url).diskCacheStrategy(DiskCacheStrategy.ALL).into(imageView);
}
public static void loadImage(Fragment fragment,String url,final ImageView imageView) {
if (imageView == null) return;
Glide.with(fragment).load(url).diskCacheStrategy(DiskCacheStrategy.ALL).into(imageView);
}
public static void loadImage(Activity activity,int res,ImageView imageView) {
if (imageView == null) return;
Glide.with(activity).load(res).diskCacheStrategy(DiskCacheStrategy.ALL).into(imageView);
}
}
网友评论