如何在Android中获取地图上的纬度和经度?
如何获取我在 Android 地图上长时间单击的特定位置的纬度和经度值?
How can I get the Latitude and Longitude values of a particular location that I have long clicked on the map in Android?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
对于长点击,我建议您查看 http://www. kind-kristiansen.no/2010/handling-longpresslongclick-in-mapactivity/。这将详细介绍如何在 Maps API 中侦听长点击事件,因为据我所知,内置功能很少或根本没有。
至于纬度/经度代码,长按后可以将像素转换为坐标。
For the long click, I suggest you check out http://www.kind-kristiansen.no/2010/handling-longpresslongclick-in-mapactivity/. This will go into detail on how to listen for long click events within the Maps API since there is little or no built-in functionality that I know of.
As for the lat/lng code, after you get the long click you can translate the pixels to coordinates.
您必须管理 LongClick 事件,然后使用以下代码来查找经度和纬度:
其中“event”是“MotionEvent”的对象。
根据您的情况使用任何其他事件。
You'll have to manage the LongClick event, and then use the code to find out longitude and latitude with the following code:
where 'event' is the object of 'MotionEvent'.
Use any other event according to your case.
它给出了地图点击点的纬度和经度
It gives latitude and longitude on which point of map click