我正在使用这个答案的代码截取 Google Map v2 的屏幕截图,输出如下:
这可以用来截取地图的屏幕截图。
使用以下代码,我可以截取黑色地图屏幕的布局屏幕截图,因为使用以下代码后,截屏中的地图将会是黑色的。
String mPath = Environment.getExternalStorageDirectory().toString()
+ "/" + "myTestScr" + System.currentTimeMillis() + ".jpeg";
Bitmap bitmap;
View v1 = (View) findViewById(R.id.rootviewtest);
v1.setDrawingCacheEnabled(true);
bitmap = Bitmap.createBitmap(v1.getDrawingCache());
v1.setDrawingCacheEnabled(false);
OutputStream fout = null;
File imageFile = new File(mPath);
try {
fout = new FileOutputStream(imageFile);
bitmap.compress(Bitmap.CompressFormat.JPEG, 90, fout);
fout.flush();
fout.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
以上代码的输出:
我实际需要的是:
那么我的问题是如何以编程方式获得第三个屏幕中的输出?
请帮助我通过合并两个(1和2)屏幕的截图来获取截图 programmatically
?
或者在拍摄两个(1和2)屏幕截图后,是否有任何其他替代方法可以以编程方式合并这两个图像?