在 Maps API v2 中完全禁用 onMarkerClickListener [英] Disable onMarkerClickListener completely in Maps API v2
问题描述
我想禁止点击/点击地图标记
.我知道您可以通过设置一个空的 map.setOnMarkerClickListener
来禁用默认行为
并返回 true;但是,这仍然需要点击标记.我想将点击传递给 onMapClickListener
.
I want to disable clicking/tapping on map markers
. I know you can disable default behavior
by setting up an empty map.setOnMarkerClickListener
and return true; However, this still takes the tap as clicking on the marker. I want to pass the tap on to the onMapClickListener
.
在我的应用程序中,点击地图会移动一个标记,如果您在靠近标记的位置点击,它只会认为您正在点击标记!你会认为有一个 Marker.setClickable
方法,但实际上没有.
In my app, tapping the map moves a marker around, and if you're tapping close to where the marker is already, it just thinks you're tapping the marker! You would think there is a Marker.setClickable
method but there isn't.
推荐答案
只需覆盖onclick事件即可:
Just override the onclick event:
map.setOnMarkerClickListener(new OnMarkerClickListener() {
public boolean onMarkerClick(Marker arg0) {
return true;
}
});
这篇关于在 Maps API v2 中完全禁用 onMarkerClickListener的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!