Last active
March 25, 2024 13:55
Revisions
-
kaushikgopal revised this gist
Nov 21, 2016 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,10 @@ Bitmap batmapBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.batman); RoundedBitmapDrawable circularBitmapDrawable = RoundedBitmapDrawableFactory.create(getResources(), batmapBitmap); // option 1 h/t [Chris Banes](https://chris.banes.me/) circularBitmapDrawable.setCornerRadius(batmapBitmap.getWidth()); // option 2 h/t @csorgod in the comments circularBitmapDrawable.setCircular(true); -
kaushikgopal revised this gist
Nov 21, 2016 . 1 changed file with 6 additions and 13 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,19 +1,12 @@ Bitmap batmapBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.batman); RoundedBitmapDrawable circularBitmapDrawable = RoundedBitmapDrawableFactory.create(getResources(), batmapBitmap); // mechanism 1 h/t [Chris Banes](https://chris.banes.me/) circularBitmapDrawable.setCornerRadius(batmapBitmap.getWidth()); // mechanism 2 h/t @csorgod in the comments circularBitmapDrawable.setCircular(true); myImageView.setImageDrawable(circularBitmapDrawable); System.out.prinln("MyActivity", "That's all folks"); -
kaushikgopal revised this gist
Feb 26, 2015 . 1 changed file with 8 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,3 @@ Bitmap batmapBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.batman); RoundedBitmapDrawable circularBitmapDrawable = // @@ -12,6 +9,11 @@ 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 */ -
kaushikgopal revised this gist
Feb 23, 2015 . 1 changed file with 7 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,13 +2,16 @@ // for pointing out the existance of [RoundedBitmapDrawable in the support libs](https://developer.android.com/reference/android/support/v4/graphics/drawable/RoundedBitmapDrawable.html) 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"); // While this is now super simple to do, I would encourage you to: // 1. read Evelio's blog post http://evel.io/2013/07/21/rounded-avatars-in-android/ (excellent for understanding different approaches) // 2. See Vince's code in this library https://github.com/vinc3m1/RoundedImageView -
kaushikgopal revised this gist
Feb 23, 2015 . 1 changed file with 5 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,11 @@ // hat tip to the amazing [Chris Banes](https://chris.banes.me/) // for pointing out the existance of [RoundedBitmapDrawable in the support libs](https://developer.android.com/reference/android/support/v4/graphics/drawable/RoundedBitmapDrawable.html) Bitmap batmapBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.batman); RoundedBitmapDrawable circularBitmapDrawable = // RoundedBitmapDrawableFactory.create(getResources(), batmapBitmap); circularBitmapDrawable.setCornerRadius(batmapBitmap.getWidth()); myImageView.setImageDrawable(circularBitmapDrawable); // That's all folks! -
kaushikgopal created this gist
Feb 23, 2015 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ // hat tip to the amazing [Chris Banes](https://chris.banes.me/) // for pointing out the existance of [RoundedBitmapDrawable in the support libs](https://developer.android.com/reference/android/support/v4/graphics/drawable/RoundedBitmapDrawable.html) Bitmap batmapBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.batman); RoundedBitmapDrawable circularBitmapDrawable = // RoundedBitmapDrawableFactory.create(getResources(), batmapBitmap); circularBitmapDrawable.setCornerRadius(batmapBitmap.getWidth()); myImageView.setImageDrawable(circularBitmapDrawable); // That's all folks! // for an indepth understanding of how this was otherwise usually done, see // 1. http://evel.io/2013/07/21/rounded-avatars-in-android/ // 2. https://github.com/vinc3m1/RoundedImageView