2
我的应用程序中我想捕捉与surfaceview屏幕,但我不能捕获屏幕上与background.how绘制与background.please一起绘制屏幕我如何解决这个问题。如何在背景中捕捉surfaceview的截图
View content = findViewById(R.id.relative21);
content.setDrawingCacheEnabled(true);
SurfaceHolder sfhTrack = drawingSurface.getHolder();
sfhTrack.setFormat(PixelFormat.TRANSPARENT);
private void getScreen() {
// TODO Auto-generated method stub
View content = findViewById(R.id.relative21);
Bitmap bitmap = content.getDrawingCache();
File myDir=new File("/sdcard/saved_images");
myDir.mkdirs();
Random generator = new Random();
int n = 10000;
n = generator.nextInt(n);
String fname = "Image-"+ n +".png";
File file = new File (myDir, fname);
try
{
FileOutputStream ostream = new FileOutputStream(file);
bitmap.compress(CompressFormat.PNG, 100, ostream);
ostream.close();
}
catch (Exception e)
{
e.printStackTrace();
}
}
我试过上面的代码我能够保存背景,但我不能保存绘制。
我也试图捕捉表面视图的框架,但它返回给我透明框架(位图),任何想法/ suggetsion请吗? – CoDe 2012-08-13 04:41:00
@Shubh嗨,你有没有想过一种捕捉表面视图框架的方法? – Wesley 2015-03-19 06:20:19
这是很遥远的..我需要检查它。 – CoDe 2015-03-19 09:23:27