I have an imageView with width:match_parent and height:wrap_content. I want the image with full width and keep the ratio for the height.
I follow this link (https://github.com/nostra13/Android-Universal-Image-Loader/pull/62) who say to set adjustviewbounds and center_crop on my imageView and set imageScaleType to ImageScaleType.EXACTLY_STRETCHED.
So i do that :
DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
.cacheInMemory()
.cacheOnDisc()
.showImageForEmptyUri(R.drawable.cache_waiting)
.showImageOnFail(R.drawable.cache_waiting)
.showStubImage(R.drawable.cache_waiting)
.imageScaleType(ImageScaleType.EXACTLY_STRETCHED)
.build();
setAdjustViewBounds(true);
setScaleType(ScaleType.CENTER_CROP);
ImageLoader.getInstance().displayImage(img.getUrl(), this,defaultOptions);
With this code, most of ImageView are white. The logcat tell me the bitmap is too large (2560,1120). How can I keep the ratio of images with UIL.
Thanks,
ImageView
did you put aforementioned code? – BetterCENTER_CROP
isn't right scale type for you. Use default scale type and then maybe it prevent "too large Bitmap" issue. – Better