2013-05-08 36 views

回答

0

你可以嘗試走片段查看的屏幕截圖:

View view = findViewById(R.id.fragmentId); 
view.setDrawingCacheEnabled(true); 
Bitmap bitmap = view.getDrawingCache(); 
BitmapDrawable bitmapDrawable = new BitmapDrawable(bitmap); 

我沒有測試它。

+0

它不工作,我測試它,截圖輸出是黑色的。 – shontauro 2013-05-19 16:17:36

+0

@shontauro是right.because我們正在繪製的地圖在谷歌地圖object.so我如何採取與銷的GoogleMap的截圖,畫出路線路徑等。 – Harshid 2013-06-03 05:18:09

1

爲了讓你可以實現這個代碼繪製:如果要直接保存在SD快照

SnapshotReadyCallback callback = new SnapshotReadyCallback() { 
    @Override 
    public void onSnapshotReady(Bitmap snapshot) { 
     mapSnapshot = snapshot; 
    } 
}; 

googleMap.snapshot(callback); 

Drawable screenshot = new BitmapDrawable(getResources(),mapSnapshot); 

,你可以按照這樣的回答: Capture screen shot of GoogleMap Android API V2