imageloader

来源:互联网 发布:webservice添加数据 编辑:程序博客网 时间:2024/06/04 19:15
public class GlideImageLoader extends com.youth.banner.loader.ImageLoader{    private ImageLoader imageLoader;    private DisplayImageOptions options;    @Override    public void displayImage(Context context, Object path, ImageView imageView) {        imageLoader = ImageLoader.getInstance();                File file = new File(Environment.getExternalStorageDirectory()+"/IMG");                if (!file.exists()){                    file.mkdirs();                }                ImageLoaderConfiguration configuration = new ImageLoaderConfiguration.Builder(context)                        .diskCache(new UnlimitedDiskCache(file))                        .build();                imageLoader.init(configuration);                options = new DisplayImageOptions.Builder()                                                .cacheInMemory(true)                                                .cacheOnDisk(true)                                                .bitmapConfig(Bitmap.Config.ARGB_8888)                                                .showImageForEmptyUri(R.mipmap.ic_launcher)                                                .showImageOnFail(R.mipmap.ic_launcher)                                                .build();        imageLoader.displayImage((String) path,imageView);    }}
原创粉丝点击