1

I am creating my first android app and I have a Google map using the MapFragment and now I need to extract an image of the map so I can place that in a ListView.

I have both a full screen Google map in one activity and a smaller Google map that fills about half a screen on another, taking a bitmap for any of them would be fine, preferably extracting a bitmap from the smaller one.

Please without this my app is pretty much useless. I heard that it is possible in Google maps APIv1 by using getRootView(), is there anything that I can do to get a bitmap or a static map in APIv2.

4

2 回答 2

3

按照这个链接

公共最终无效快照(GoogleMap.SnapshotReadyCallback 回调)

拍摄地图的快照。当交互式地图难以或不可能使用时,您可以在应用程序中使用快照。例如,使用 snapshot() 方法生成的图像可用于在您的应用中显示地图的缩略图,或在通知中心显示快照。

于 2013-08-14T12:19:10.377 回答
1

到目前为止,您无法截取地图的屏幕截图。原因是用于 android 的 Google map v2 基于 GLSurfaceView 的扩展类(因此受 Pro-guard 保护)。因此,不支持通常的截屏方法。

Google 错误列表上有一个针对此问题的增强请求,希望这将很快作为一项功能添加。

现在,我建议向下移动到 API v1(如果可以的话,因为谷歌也停止提供 API v1 密钥)。

于 2013-07-24T17:36:06.980 回答