1
我想使用代码拍摄透明应用程序的屏幕截图。使用这段代码,我只能看到外部视图的屏幕截图。请帮助Android中的透明应用程序的屏幕截图
View v = getWindow().getDecorView().getRootView();
v.setDrawingCacheEnabled(true);
Bitmap b = v.getDrawingCache();
try{
File sdcard = Environment.getExternalStorageDirectory();
File pictureDir = new File(sdcard, "picopaint");
pictureDir.mkdirs();
File f = null;
for (int i = 1; i < 200; ++i){
String name = "screen" + i + ".png";
f = new File(pictureDir, name);
if (!f.exists()) {
break;
}
}
if (!f.exists()) {
String name = f.getAbsolutePath();
FileOutputStream fos = new FileOutputStream(name);
b.compress(Bitmap.CompressFormat.PNG, 100, fos);
fos.flush();
fos.close();
}
} catch (Exception e) {}
你现在得到修改? – Ishtiaq
你有没有找到解决方案? – Wops
我也有这个问题你有代码为 – anddevmanu