Advertisement
Guest User

Untitled

a guest
Jul 24th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. ```
  2. private Bitmap loadBitmapFromView(View v) {
  3.  
  4. int specWidth = View.MeasureSpec.makeMeasureSpec(900 /* any */, View.MeasureSpec.EXACTLY);
  5. v.measure(specWidth, specWidth);
  6. int questionWidth = v.getMeasuredWidth();
  7.  
  8. Bitmap b = Bitmap.createBitmap( questionWidth, questionWidth, Bitmap.Config.ARGB_8888);
  9. Canvas c = new Canvas(b);
  10. c.drawColor(Color.WHITE);
  11. v.layout(v.getLeft(), v.getTop(), v.getRight(), v.getBottom());
  12. v.draw(c);
  13. return b;
  14. }
  15.  
  16. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement