如何从MapActivity捕捉位置 [英] How to capture location from MapActivity
问题描述
由于...
- 从MapActivity延伸的活动
- 使用ItemizedOverlay表现出一定的气球在地图上
- ZoomControls启用
在ItemizeOverlay工具中的onTap(...)
攻覆盖项目之一,当它的工作原理完全确定。
The ItemizeOverlay implements onTap(...)
which works perfectly ok when tapping one of the overlay items.
现在的问题是:如何识别轻点地图的另一部分(与得到的位置和center'ing在这一点上的意图)
The question is: How to identify a tap on another part of the map (with the intention of getting the location and center'ing on that point)
推荐答案
您应该能够创建一个看不见的覆盖(在你不画在的OnDraw $任何意义C $ C>),坐落在图形页面的覆盖列表的前面和
中的onTap
,设置地图中心<一href="http://$c$c.google.com/android/add-ons/google-apis/reference/com/google/android/maps/MapController.html#setCenter(com.google.android.maps.GeoPoint)"相对=nofollow> MapController.setCenter 。
You should be able to create an 'invisible' overlay (in the sense that you don't draw anything in onDraw
) that sits at the front of the MapView's overlay list and in onTap
, sets the map center with MapController.setCenter.
要引用<一href="http://$c$c.google.com/android/add-ons/google-apis/reference/com/google/android/maps/MapView.html#getOverlays()"相对=nofollow>关于叠加顺序调用MapView.getOverlays 文档:
任何叠加在这个名单将被吸引(顺序递增),并将收到的事件(按递减顺序,直到其中一个返回true)。如果修改的列表中,你可能会想打电话给View.postInvalidate(),这样的变化将作出对用户可见。
Any Overlays in this list will be drawn (in increasing order) and will receive events (in decreasing order, until one returns true). If you modify the list, you will probably want to call View.postInvalidate() so that the change will be made visible to the user.
这篇关于如何从MapActivity捕捉位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!