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

/**
* 生成图片
*/
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;
}

推荐阅读更多精彩内容