异常:java.lang.IllegalArgumentException: ImageAware should wrap ImageView. ImageView
解决方法:
private void initImageLoader(Context context){
options= new DisplayImageOptions.Builder()
.showImageForEmptyUri(R.drawable.local_image_default)
.showImageOnFail(R.drawable.local_image_default)
.resetViewBeforeLoading(false)
.cacheInMemory(true)
.cacheOnDisc(true)
.imageScaleType(ImageScaleType.EXACTLY_STRETCHED)
.bitmapConfig(Bitmap.Config.RGB_565)
//.displayer(new RoundedBitmapDisplayer(5))注释改行
.build();
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
.threadPriority(Thread.NORM_PRIORITY - 2)
.denyCacheImageMultipleSizesInMemory()
.tasksProcessingOrder(QueueProcessingType.FIFO)
.defaultDisplayImageOptions(options)
.build();
ImageLoader.getInstance().init(config);
}
2.获取下载的Bitmap对象
imageLoader.loadImage(String.valueOf(resId),new ImageSize(thisView.getWidth(), thisView.getHeight()), new SimpleImageLoadingListener(){
@Override
public void onLoadingComplete(String imageUri, View view,
Bitmap loadedImage) {
mBitmap=loadedImage;
}
});
3.使用下载的Bitmap对象
if(mBitmap!=null){
this.setBackground(new CircleDrawable(mBitmap,10));
}else{
this.setBackgroundResource(R.drawable.welcomeselectbg2);
}