简体   繁体   English

如何在Android中启用缩放功能的情况下将标记放置在地图底部而不是地图中心(默认情况下)?

[英]How to put marker at bottom of map instead of center(by default) of map with zoom enabled in android?

In live track app I want to animate camera above marker and want to put marker always at bottom in newLocationChanged. 在实时跟踪应用中,我想为标记上方的摄像机设置动画,并希望将标记始终放置在newLocationChanged中的底部。

If I am building CameraPosition without zoom, It works fine. 如果我在不缩放的情况下构建CameraPosition,则效果很好。

But with zoom also I need to achieve same. 但是使用变焦我也需要达到相同的效果。

Use the screen boundaries to get the desired position: 使用屏幕边界获取所需位置:

As per documentation: 根据文档:

getBounds() getBounds()
Return Value: LatLngBounds 返回值:LatLngBounds

Returns the lat/lng bounds of the current viewport. 返回当前视口的纬度/经度边界。 If more than one copy of the world is visible, the bounds range in longitude from -180 to 180 degrees inclusive. 如果可以看到一个以上的世界副本,则边界的经度范围为-180至180度(含)。 If the map is not yet initialized (ie the mapType is still null), or center and zoom have not been set then the result is null or undefined. 如果地图尚未初始化(即mapType仍为null),或者尚未设置中心和缩放,则结果为null或未定义。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM