当前位置:   article > 正文

university-imageloader使用遇到的异常及解决方法_imageaware should wrap imageview

imageaware should wrap imageview

异常: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);

}


声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/很楠不爱3/article/detail/105841?site
推荐阅读
相关标签
  

闽ICP备14008679号