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,
As kingargyle said using RoundedImageView is the best approach and you can achieve what you want by just doing this:
So, if you don't need to costumize a lot of cache options, using Picasso instead of Universal Image Loader with RoundedImageView it's the best option.
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
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.
The solution of Tim is good but in my case if the image is larger then taller the image is more oval than circle. Try this code, it works with every image size :
Use it as a normal displayer:
If you want a circular image you can change
.displayer(new RoundedBitmapDisplayer(25))
to.displayer(new RoundedBitmapDisplayer(1000))
which worked for me.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.
Use
.displayer(new CircleBitmapDisplayer())
in DisplayImageOptionsalong with
in you module level build.gradle.