且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

谷歌地图上添加标记在Android的触摸位置

更新时间:2022-04-23 09:59:39

图形页面您必须使用 onTouch 代替的的onClick 。在 motionEvent ,此事件触发,具有触摸从 getProjection()法坐标,以便图形页面您可以将触摸坐标转换为纬度和长把覆盖标记)在地图上。

In MapView you must use onTouch instead of onClick. The motionEvent that this event fires, has the touch coordinates so with the getProjection() method from MapView you can convert the touch coordinates into lat and long to put the Overlay (Marker) on the map.