android - 如何在不实际显示 map 的情况下拍摄谷歌地图快照

标签 android google-maps android-googleapiclient

我希望能够截取谷歌地图中某个位置的屏幕截图,而无需实际将谷歌地图加载到屏幕上,如果谷歌地图可以在后台截取屏幕截图,那就太好了。

最佳答案

Lite Mode :

The Google Maps Android API can serve a static image as a 'lite mode' map.

A lite mode map is a bitmap image of a map at a specified location and zoom level. Lite mode supports all of the map types (normal, hybrid, satellite, terrain) and a subset of the functionality supplied by the full API. Lite mode is useful when you want to provide a number of maps in a stream, or a map that is too small to support meaningful interaction.

例子:

作为 MapView 或 MapFragment 的 XML 属性

<fragment xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:map="http://schemas.android.com/apk/res-auto"
    android:name="com.google.android.gms.maps.MapFragment"
    android:id="@+id/map"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    map:cameraZoom="13"
    map:mapType="normal"
    map:liteMode="true"/>

在 GoogleMapOptions 对象中

GoogleMapOptions options = new GoogleMapOptions().liteMode(true);

Here您可以找到支持的功能。


另外我推荐阅读:Android Google Map to show as picture

You can use the Google Maps built-in snapshot method, to capture a preview and display it in an ImageView.

关于android - 如何在不实际显示 map 的情况下拍摄谷歌地图快照,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29870337/

相关文章:

android - 无法连接到 GoogleAPIClient LocationServices.API

android模拟器无法打开音频输出

android - 已发布的 Android 应用程序崩溃

android - 解雇后单挑通知卡在全屏模式

java - 尝试访问 SQLite 表的 Activity 中出现 Null 错误

java - Google Maps API V2 崩溃 - 致命异常

javascript - 双击时如何创建突出显示图像?

javascript - 如何将此地理编码请求分配给变量?

android - GMail API 在 UserRecoverableAuthUIException 之前授予权限

android - GoogleApiClient : hide GPS icon on status bar when a service is in the background