谷歌地图上添加标记在Android的触摸位置 [英] Add marker on google map on touched location in Android
问题描述
谁能帮我在下面的任务:
Can anyone help me in the following task:
我想补充在谷歌地图标记中的机器人。
I want to add a marker in google map in android.
的功能必须是这样的,一个弹出窗口已经被显示以添加触摸位置作为标记
The functionality has to be like this that a pop up window have to be shown to add the touched location as a marker.
我是指下面的教程中,他们通过辛勤添加标记编码。
I was referring the below tutorial in that they add the marker through hard coding.
http://developer.android.com/resources/tutorials/意见/ HELLO-mapview.html
我希望它是用onclck在地图上进行。
I want it that to be done using onclck on the map.
推荐答案
在图形页面
您必须使用 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.
这篇关于谷歌地图上添加标记在Android的触摸位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!