gpt4 book ai didi

android - 标记位置更改事件

转载 作者:太空宇宙 更新时间:2023-11-03 11:51:11 25 4
gpt4 key购买 nike

我正在使用新的 Android 版 Google map v2。有没有办法为标记位置更改设置监听器?例如,当用户拖动标记时。

最佳答案

引用 the documentation :

You can use an OnMarkerDragListener to listen for drag events on a marker. To set this listener on the map, call GoogleMap.setOnMarkerDragListener. To drag a marker, a user must long press on the marker. When the user takes their finger off the screen, the marker will stay in that position. When a marker is dragged, onMarkerDragStart(Marker) is called initially. While the marker is being dragged, onMarkerDrag(Marker) is called constantly. At the end of the drag onMarkerDragEnd(Marker) is called. You can get the position of the marker at any time by calling Marker.getPosition().

Here is a sample project演示了 OnMarkerDragListener 的使用。

关于android - 标记位置更改事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14491069/

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