2012-01-20 65 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