我想为这些标记中的每一个添加一个onClick,因此我无法为每个标记打开一个新活动,这可能是一组标记吗?
出于某种原因,它不会让我发布我的代码,任何建议?
答案 0 :(得分:1)
没有任何代码就很难帮助你看看你在做什么,但是......
这种方式的工作方式是你有一个像这样的GoogleMap对象
private GoogleMap mMap;
然后你打电话给
mMap.setOnMarkerClickListener(someObject);
其中someObject是实现OnMarkerClickListener的类的实例,这意味着它有一个这样的方法。
@Override
public boolean onMarkerClick(Marker marker) {
// identify the marker you want and then do what ever you think should be done
// for example when you added the marker, you could have given it a unique title
// which you can check of here using
if (marker.getTitle.equals("blah") {
// do something
} else {
// do something else
}
return true;
}