gpt4 book ai didi

android - 谷歌地图 api v2 在标记附近缩放

转载 作者:IT老高 更新时间:2023-10-28 23:26:24 25 4
gpt4 key购买 nike

我在 android 中使用 Google maps api v2。我使用 latitude 和 longitude 放置了一个标记。标记显示在正确的位置,但我希望 map 应该只显示标记周围的区域。即我想在显示 map 时缩放到标记位置,以便它只显示标记的附近区域。任何帮助都是很棒。

最佳答案

在此函数中传递您放置标记的当前位置。

private void moveToCurrentLocation(LatLng currentLocation)
{
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(currentLocation,15));
// Zoom in, animating the camera.
googleMap.animateCamera(CameraUpdateFactory.zoomIn());
// Zoom out to zoom level 10, animating with a duration of 2 seconds.
googleMap.animateCamera(CameraUpdateFactory.zoomTo(15), 2000, null);


}

关于android - 谷歌地图 api v2 在标记附近缩放,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16458900/

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