2012-01-20 23 views

回答

2

尝试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(); 
    } 
+0

三江源dudeeeeee上MapView工作藏汉

代码..... awsme其工作......... –

+0

@SreeDev,很高兴我能帮忙。 :) – st0le