Has anyone managed to use RoundedBitmapDrawable
? Correct me if I'm wrong, but to my understanding, it makes a circular image from a regular rectangular image.
What I've tried so far is this
RoundedBitmapDrawable.createRoundedBitmapDrawable(getResources(), BitmapFactory.decodeResource(getResources(), iconResource))
What I tried to achieve: transform any image to a circular image and show it using an ImageView.
In case I mixed things up and all that I said is non-sense. Is it possible (or simpler) to do it with any of the new framework? (Android L or new Support Library)
i am also finding rounded image view for efficiency i have search all third party library i found that all of them they are creating new bitmap which is tedious task in list its consuming more memory
refereed library:
from this library i have used
because A fast ImageView (and Drawable) that supports rounded corners (and ovals or circles) based on the original example from Romain Guy
It may be a late reply but i hope that it will be helpful to others
If your image has same width and height then you can simply set the setCircular to true to get Rounded Bitmap as follows
Full code:
You need to set the corner radius.
I created a Utility class to create RoundedBitmapDrawables https://gist.github.com/lawloretienne/a91fb0ce40f083073d4b8939281b3ecb
It works for circles and rounded squares.
I would like to suggest another option:
you can use this method in order to scale it according to your needs and avoid this Exception: