我尝试从帧缓冲区获取屏幕截图,它适用于我的布局视图,我从这里使用了以下代码:
String mPath = Environment.getExternalStorageDirectory().toString() + "/" + ACCUWX.IMAGE_APPEND;
// create bitmap screen capture
Bitmap bitmap;
View v1 = mCurrentUrlMask.getRootView();
v1.setDrawingCacheEnabled(true);
bitmap = Bitmap.createBitmap(v1.getDrawingCache());
v1.setDrawingCacheEnabled(false);
OutputStream fout = null;
imageFile = new File(mPath);
try {
fout = new FileOutputStream(imageFile);
bitmap.compress(Bitmap.CompressFormat.JPEG, 90, fout);
fout.flush();
fout.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
但我想用相机视图捕捉布局视图,因为我也在布局视图或透明网页的背景中使用相机视图。一种解决方法是分别拍摄相机图像和布局视图并将它们放在一起并保存新的位图。
谁能建议我对此有任何适当的解决方案?提前致谢