Android地图叠加,通过代码触发onTap事件
我有自己的类,可以将标记放在地图视图上,如下所示...
public class MyMapActivity extends MapActivity
{
private MapItemizedOverlay itemizedOverlay;
@Override
public void onCreate(Bundle savedInstanceState)
{
for(a loop to put all 10 datas into overlay)
{
OverlayItem overlayitem=new OverlayItem(some params);
overlayitem.setMarker(some bitmap);
itemizedOverlay.addOverlay(overlayitem);
}
mapView.getOverlays().add(itemizedOverlay);
}
}
public class MapItemizedOverlay extends ItemizedOverlay<OverlayItem>
{
//some code
@Override
protected boolean onTap(int index)
{
//Here I know what marker been clicked...
//and I already did when marker been clicked, an info window
//can be shows up.
}
}
例如,我有 10 个数据集,在地图和 ListView 上显示为 10 个标记。 我想做的是当我单击 ListView 的第三行,即第三个标记时 会弹出一个信息窗口,就像我点击它一样......
我该怎么做?
I have my own class to put marker over mapview like following...
public class MyMapActivity extends MapActivity
{
private MapItemizedOverlay itemizedOverlay;
@Override
public void onCreate(Bundle savedInstanceState)
{
for(a loop to put all 10 datas into overlay)
{
OverlayItem overlayitem=new OverlayItem(some params);
overlayitem.setMarker(some bitmap);
itemizedOverlay.addOverlay(overlayitem);
}
mapView.getOverlays().add(itemizedOverlay);
}
}
public class MapItemizedOverlay extends ItemizedOverlay<OverlayItem>
{
//some code
@Override
protected boolean onTap(int index)
{
//Here I know what marker been clicked...
//and I already did when marker been clicked, an info window
//can be shows up.
}
}
For example, I have 10 data set, shows as 10 markers on map, and on a ListView.
What I would like to do is when I click 3rd row of ListView, the 3rd marker
will pop-up an info window, just like I'm clicked on it...
How can I do this ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论