Created
October 7, 2019 09:27
-
-
Save MotasemF/2e5ae8598e85cf4d9350e7a5079115dd to your computer and use it in GitHub Desktop.
Layout_to_Image
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 class Layout_to_Image { | |
View _view; | |
Context _context; | |
Bitmap bMap; | |
public Layout_to_Image(Context context, View view) | |
{ | |
this._context=context; | |
this._view =view; | |
} | |
public Bitmap convert_layout() | |
{ | |
_view.setDrawingCacheEnabled(true); | |
_view.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)); | |
_view.layout(0, 0, _view.getMeasuredWidth(), _view.getMeasuredHeight()); | |
_view.buildDrawingCache(true); | |
bMap = Bitmap.createBitmap(_view.getDrawingCache()); | |
return bMap; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment