android - 如何从 Google map V2 获取快照

标签 android google-maps-android-api-2 supportmapfragment

我想知道如何从 SupportMapFragment 获取快照。我不知道。请帮忙。

感谢您的提前。

最佳答案

要获得可绘制对象,您可以实现以下代码:

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

googleMap.snapshot(callback);

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

如果您想直接将快照保存在SD上,您可以按照以下答案: Capture screen shot of GoogleMap Android API V2

关于android - 如何从 Google map V2 获取快照,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16435842/

相关文章:

java - 是否有 API 可以检查系统是否是 android,而不是桌面 jvm?

android - Webview 显示不安全的内容

android - Google maps Android API获取wifi位置

android - 使用地理位置 Google map API v2

android - ClassNotFoundException 在 onSaveInstanceState 中读取扩展 MapFragment 的类中的可序列化对象

android - 无法模拟 android.util.Patterns.EMAIL_ADDRESS.pattern()

java - 关于序列化、serialVersionUID、类不兼容

android - 除非您更新 Google Play 服务(通过 Bazaar),否则此应用将无法运行

android - X,Y 图像坐标旋转到纬度和经度

android - 第二次打开 SupportMapFragment 时出错