【发布时间】:2012-01-20 08:35:20
【问题描述】:
我想通过调用意图或从地图视图从地图中制作特定位置的快照。谁能帮助我。我没有得到快照。
【问题讨论】:
标签: android maps location snapshot
我想通过调用意图或从地图视图从地图中制作特定位置的快照。谁能帮助我。我没有得到快照。
【问题讨论】:
标签: android maps location snapshot
试试this 的帖子,我相信这会有所帮助。它涉及启用绘图缓存并强制它使用该缓存。通常适用于所有视图。也应该在MapView 上工作
链接中的代码
private Bitmap getMapImage() {
/* Position map for output */
MapController mc = mapView.getController();
mc.setCenter(SOME_POINT);
mc.setZoom(16);
/* Capture drawing cache as bitmap */
mapView.setDrawingCacheEnabled(true);
Bitmap bmp = Bitmap.createBitmap(mapView.getDrawingCache());
mapView.setDrawingCacheEnabled(false);
return bmp;
}
private void saveMapImage() {
String filename = "foo.png";
File f = new File(getExternalFilesDir(null), filename);
FileOutputStream out = new FileOutputStream(f);
Bitmap bmp = getMapImage();
bmp.compress(Bitmap.CompressFormat.PNG, 100, out);
out.close();
}
【讨论】: