美文网首页
截取界面某些控件生成图片

截取界面某些控件生成图片

作者: 江南_烟雨 | 来源:发表于2017-06-24 14:54 被阅读0次

/**
* 生成图片
*/
private Bitmap createBitmap(){
int width = llShare.getMeasuredWidth();
int height = llShare.getMeasuredHeight();
int[] pixels = new int[width * height];
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
pixels[y * width + x] = WHITE;
}
}
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565);
bitmap.setPixels(pixels, 0, width, 0, 0, width, height);
Canvas c = new Canvas(bitmap);
llShare.layout(llShare.getLeft(), llShare.getTop(), llShare.getRight(), llShare.getBottom());
llShare.draw(c);
return bitmap;
}

相关文章

网友评论

      本文标题:截取界面某些控件生成图片

      本文链接:https://www.haomeiwen.com/subject/hxjkcxtx.html