加载图片类

作者: 根艮哏艮根 | 来源:发表于2018-01-16 09:11 被阅读5次
    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);
        }
    
    }
    

    相关文章

      网友评论

        本文标题:加载图片类

        本文链接:https://www.haomeiwen.com/subject/rskcvxtx.html