Created
August 19, 2016 17:42
-
-
Save joshskeen/17131e9581a27d8ba5c74619f4862fec to your computer and use it in GitHub Desktop.
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 characters
public static Bitmap getBitmapFromView(View view) { | |
Bitmap returnedBitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(),Bitmap.Config.ARGB_8888); | |
Canvas canvas = new Canvas(returnedBitmap); | |
Drawable bgDrawable =view.getBackground(); | |
if (bgDrawable!=null) | |
bgDrawable.draw(canvas); | |
else | |
canvas.drawColor(Color.WHITE); | |
view.draw(canvas); | |
return returnedBitmap; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment