gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:40:02 24 4
gpt4 key购买 nike

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

最佳答案

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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com