Forked from kaushikgopal/RoundedBitmapDrawableUsage.java
Last active
August 29, 2015 14:18
-
-
Save BrandonSmith/f8a0b809219ba7dd0fc1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Bitmap batmapBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.batman); | |
RoundedBitmapDrawable circularBitmapDrawable = // | |
RoundedBitmapDrawableFactory.create(getResources(), batmapBitmap); | |
circularBitmapDrawable.setCornerRadius(batmapBitmap.getWidth()); | |
myImageView.setImageDrawable(circularBitmapDrawable); | |
System.out.prinln("MyActivity", "That's all folks"); | |
/* | |
Hat tip to the amazing [Chris Banes](https://chris.banes.me/) | |
for pointing out [RoundedBitmapDrawable in the support libs](https://developer.android.com/reference/android/support/v4/graphics/drawable/RoundedBitmapDrawable.html) | |
While this is now super simple to do, I would encourage you to | |
read Evelio's blog post http://evel.io/2013/07/21/rounded-avatars-in-android/ | |
as it'll help you gain a good understanding of drawable/bitmap manipulation */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment