1 回答
cynthiaty
TA贡献7条经验 获得超4个赞
/** * 页面视图生成图片(view to bitmap) */ public static Bitmap view_convert_bitmap(final View v) { v.setDrawingCacheEnabled(true); v.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)); v.layout(0, 0, v.getMeasuredWidth(), v.getMeasuredHeight()); v.buildDrawingCache(true); Bitmap bitmap = Bitmap.createBitmap(v.getDrawingCache()); v.setDrawingCacheEnabled(false); // clear drawing cache return bitmap; }
- 1 回答
- 1 关注
- 1698 浏览
添加回答
举报
0/150
提交
取消