如何在不实际显示地图的情况下拍摄 google 地图快照

How to take google maps snapshot without actually displaying the map

我希望能够截取 google 地图中某个位置的屏幕截图,而无需实际将 google 地图加载到屏幕上,如果有办法 google 地图能在后台截图就好了

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.