I have a ScrollView layout with "layout_width="match_parent",layout_height="match_parent"",and it have a child LinearLayout.the child is heighter than the screen.I want to get the child's bitmap,but use getDrawingCache() only get the picture which height equal the screen ,how can i get the child's complete picture.
Asked
Active
Viewed 316 times
1 Answers
1
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(0, 0, v.getLayoutParams().width, v.getLayoutParams().height);
v.draw(c);
return b;
}
How about drawing the view on a canvas ?

Triode
- 11,309
- 2
- 38
- 48