【发布时间】:2012-11-13 22:50:35
【问题描述】:
我尝试从帧缓冲区截屏,它适用于我的布局视图 我使用了here的以下代码:
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();
}
但我想用相机视图捕捉布局视图,因为我也在布局视图或透明网页的背景中使用相机视图。 一种解决方法是分别拍摄相机图像和布局视图并将它们放在一起并保存新的位图。
谁能建议我任何适当的解决方案? 提前致谢
【问题讨论】:
-
相机打开时如何拍照?实际上我需要在屏幕中打开相机时进行屏幕截图/
-
@mrYogi:你有什么解决办法吗?
标签: android android-layout android-camera augmented-reality screen-capture