无法获取的GoogleMap OnMarkerClickListener工作 [英] Unable to get GoogleMap OnMarkerClickListener to work
问题描述
使用V2地图。
得到了所有主要的工作,包括标记添加。
Got it all basically working, including adding of markers.
不过,我需要采取行动时,该标记被窃听,所以我安装了一个处理程序:
However, I need to take action when the marker is tapped, so I've installed a handler:
thisMap.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() {
@Override public boolean onMarkerClick(Marker marker) {
// Take some action here
return true;
}
}
);
唯一的问题是 - onMarkerClick()
永远不会被调用。不明白为什么 - 尝试创建监听器最初创建和地图时也经过标记到位,没有什么区别
Only problem is - onMarkerClick()
never gets called at all. Cannot see why - tried creating the listener when the map was originally created and also after the marker is put in place, no difference.
推荐答案
设法得到它通过使用OnInfoWindowClickListener,而不是工作。不知道为什么会到标记点击,虽然没有回应。
Managed to get it to work by using the OnInfoWindowClickListener instead. Don't know why it wouldn't respond to the marker click though.
这篇关于无法获取的GoogleMap OnMarkerClickListener工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!