Android:向 MapView 添加叠加层?
我将 Overlay 子类化为 LandMarkOverlay(并实现了 onTap(GeoPoint) 方法)。
在主要活动中,我这样做:
setContentView(R.layout.main);
MapView mapView = (MapView) findViewById(R.id.mapview);
mapView.setBuiltInZoomControls(true);
landmarkOverlay = new LandmarkOverlay();
//add the landmarkOverlay to the list
mapView.getOverlays().add(landmarkOverlay);
我还需要做什么,以便当用户点击屏幕时,landmarkOverlay
的 onTap(GeoPoint)
方法被调用?
I have subclassed Overlay as LandMarkOverlay (and implemented an onTap(GeoPoint) method).
In the main activity I do this:
setContentView(R.layout.main);
MapView mapView = (MapView) findViewById(R.id.mapview);
mapView.setBuiltInZoomControls(true);
landmarkOverlay = new LandmarkOverlay();
//add the landmarkOverlay to the list
mapView.getOverlays().add(landmarkOverlay);
What else do I need to do so that when the user taps the screen, landmarkOverlay
's onTap(GeoPoint)
method gets called?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它应该被调用。我假设你的方法是
onTap(GeoPoint point, MapView mapView)
?It should get called. I assume your method is
onTap(GeoPoint point, MapView mapView)
?