ImageLoader图片加载简单使用
1.application注册ImageLoader
ImageLoaderConfiguration configuration = ImageLoaderConfiguration .createDefault(this); ImageLoader.getInstance().init(configuration);
2.adapter里配置参数
mOptions = new DisplayImageOptions.Builder() .showImageForEmptyUri(R.mipmap.ic_launcher) // resource or drawable .showImageOnFail(R.mipmap.ic_launcher) // resource or drawable .delayBeforeLoading(100) .cacheInMemory() // default .cacheOnDisc() .bitmapConfig(Bitmap.Config.ARGB_8888) // default .displayer(new FadeInBitmapDisplayer(500)) .displayer(new RoundedBitmapDisplayer(12)) .build();3.与imageView绑定
ImageView iv_home_item_icon = mVewHolder.getView(R.id.iv_home_item_icon); ImageLoader.getInstance().displayImage(HttpConstant.IMAGE+mList.get(position).getIconUrl(), iv_home_item_icon, mOptions);