0
我想通过调用intent或mapview来从地图上创建一个特定位置的快照。任何人都可以帮助我。我没有获取快照。来自android中地图的快照
我想通过调用intent或mapview来从地图上创建一个特定位置的快照。任何人都可以帮助我。我没有获取快照。来自android中地图的快照
尝试this后,我相信这应该有所帮助。它涉及启用绘图缓存并强制它使用该缓存。通常适用于所有视图。应该从链接
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();
}
三江源dudeeeeee上
MapView
工作藏汉代码..... awsme其工作......... –
@SreeDev,很高兴我能帮忙。 :) – st0le