Created
March 14, 2016 15:02
-
-
Save aykuttasil/da03aef775f9144b6898 to your computer and use it in GitHub Desktop.
From http://stackoverflow.com/questions/2801116/converting-a-view-to-bitmap-without-displaying-it-in-android Convert View to Bitmap
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
public static Bitmap loadBitmapFromView(View v) { | |
Bitmap b = Bitmap.createBitmap( v.getLayoutParams().width, v.getLayoutParams().height, Bitmap.Config.ARGB_8888); | |
Canvas c = new Canvas(b); | |
v.layout(v.getLeft(), v.getTop(), v.getRight(), v.getBottom()); | |
v.draw(c); | |
return b; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment