事件标记位置的变化 [英] Event for marker position change

查看:180
本文介绍了事件标记位置的变化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是谷歌新地图Android版V2。
有没有一种方法来设置标记的位置变化的听众?例如,当用户拖动标记。

I'm using the new Google Maps for Android v2. Is there a way to set a listener for marker position change? For example when the user drag the marker.

推荐答案

文档

您可以使用OnMarkerDragListener监听一个标记拖动事件。要在地图上设置此监听器,调用GoogleMap.setOnMarkerDragListener。要拖动标记,标记上的用户必须长时间preSS。当用户需要他们的手指离开屏幕,标记将停留在该位置。当一个标记被拖动,onMarkerDragStart(标记)最初调用。当标记被拖动,onMarkerDrag(标记)不断呼吁。在拖动onMarkerDragEnd的端部(标记)被调用。你可以通过调用Marker.getPosition()获得在任何时间标记的位置。

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().

这里是展示了使用 OnMarkerDragListener 。

这篇关于事件标记位置的变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆