【问题标题】:How to get Bitmap of MapView from Android Google Maps API V2如何从 Android Google Maps API V2 获取 MapView 的位图
【发布时间】:2013-01-18 10:09:59
【问题描述】:

我正在将我的应用更新到新的 Android Maps API V2,但在尝试获取当前显示地图的位图图像时遇到了问题。在 API V1 中,我这样做了:

Bitmap mBitmap;
MapViwe mMapView;
// ...
mBitmap = Bitmap.createBitmap(MAP_WIDTH, MAP_HEIGHT, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(mBitmap);
mMapView.draw(canvas);

虽然在 API V1 中,这给了我一张地图的位图,但在 API V2 中,我得到的只是一个黑色矩形。

对于 API V2,我使用的是 MapView,而不是 MapFragment,所以这不是问题。

【问题讨论】:

    标签: android bitmap android-maps-v2


    【解决方案1】:

    GoogleMap.snapshot() 方法完成了这项工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-02-19
      • 1970-01-01
      • 2012-11-21
      • 1970-01-01
      • 1970-01-01
      • 2013-02-14
      • 2015-09-11
      • 2013-03-22
      相关资源
      最近更新 更多