I'm using latest universal-image-loader-1.9.2-SNAPSHOT-with-sources.jar file. Its working fine. I want to change image to round(Circle). I have used following display options.
DisplayImageOptions userimgoptions = new DisplayImageOptions.Builder()
.displayer(new RoundedBitmapDisplayer(35))
.showImageOnLoading(android.R.color.transparent)
.showImageForEmptyUri(R.drawable.picture_info_profile_img)
.showImageOnFail(R.drawable.picture_info_profile_img)
.cacheInMemory(true).cacheOnDisc(true)
.bitmapConfig(Bitmap.Config.RGB_565).build();
its not working for some images. I have tested this into low and high resolution its not working.
Note : In my xml Imageview height and with(55 * 55).
please kindly help me how to resolve this issue. i cant resolve this issue.
Thanks,
If you want a circular image you can change .displayer(new RoundedBitmapDisplayer(25))
to .displayer(new RoundedBitmapDisplayer(1000))
which worked for me.
If you want a rounded image you need to set the rounded bitmap displayer to the radius of the image which in your case is 1/2 55 or 27.5
DisplayImageOptions userimgoptions = new DisplayImageOptions.Builder()
.displayer(new RoundedBitmapDisplayer((int) 27.5f))
.showImageOnLoading(android.R.color.transparent)
.showImageForEmptyUri(R.drawable.picture_info_profile_img)
.showImageOnFail(R.drawable.picture_info_profile_img)
.cacheInMemory(true).cacheOnDisc(true)
.bitmapConfig(Bitmap.Config.RGB_565).build();
But it's probably not a good idea to hard code that, I would change the config when you actually get the bitmap and calculate the width.
I've found the RoundedBitmpDisplayer to be pretty slow even with the latest rewrite. By far the fastest way I've found to get a Rounded corners consistently is to use RoundedImageView. https://github.com/vinc3m1/RoundedImageView You can pass that view into UIL and the view will take care of rounding the corners for you. You just specify the radius you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With