-1
我需要拍摄视图(线性布局)的屏幕截图和内部线性布局有一个图像,当我正在拍摄该视图的屏幕截图并存储到SD卡时,屏幕截图存储但它幻灯片图像背景颜色(白色阴影看起来像浅绿色)。绿色阴影同时拍摄屏幕拍摄的视图
我写了下面的代码来拍摄屏幕截图。
图像保存为PNGpublic static boolean saveImageAsPNG(Bitmap p_bitmap, String p_destinationPath) throws Throwable
{
if (p_bitmap != null || p_destinationPath != null)
{
FileOutputStream m_out = new FileOutputStream(p_destinationPath);
return p_bitmap.compress(Bitmap.CompressFormat.PNG, 100, m_out);
}
return false;
}
附着屏幕截图请有看看
Bitmap mScreenShot = null;
mScreenShot = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
mScreenShot.setDensity(view.getResources().getDisplayMetrics().densityDpi);
Canvas mCanvas = new Canvas(mScreenShot);
mCanvas.drawColor(0, PorterDuff.Mode.SRC_IN);
view.draw(mCanvas);
ImageHelper.saveImageAsPNG(mScreenShot,filePath);
方法。 只用帆布和不设置任何参数,它请帮我
感谢您的答复,但它不工作 –
你是什么LinerarLayout的背景颜色?它是白色的吗?如果不是,则尝试将LinearLayout背景设置为白色。 –
是试过这一个。但实际上它是一个画布画的问题。它改变RGB颜色 –