如何禁用标记的 TITLE 点击事件?
How to disable marker's TITLE click event?
我已经看到如何禁用标记点击事件,但我不知道如何禁用标记 TITLE 点击事件。如果我禁用标记点击事件,标题仍然可以点击。如何在第一次点击后禁用它?
这是我试过的:
mMap.setOnInfoWindowClickListener(marker -> {
//What to do?
});
尝试使用此代码
Marker lastOpenned = null;
mMap.setOnMarkerClickListener(new OnMarkerClickListener() {
public boolean onMarkerClick(Marker marker) {
// Check if there is an open info window
if (lastOpenned != null) {
// Close the info window
lastOpenned.hideInfoWindow();
// Is the marker the same marker that was already open
if (lastOpenned.equals(marker)) {
// Nullify the lastOpenned object
lastOpenned = null;
// Return so that the info window isn't openned again
return true;
}
}
// Open the info window for the marker
marker.showInfoWindow();
// Re-assign the last openned such that we can close it later
lastOpenned = marker;
// Event was handled by our code do not launch default behaviour.
return true;
}
});
我已经看到如何禁用标记点击事件,但我不知道如何禁用标记 TITLE 点击事件。如果我禁用标记点击事件,标题仍然可以点击。如何在第一次点击后禁用它?
这是我试过的:
mMap.setOnInfoWindowClickListener(marker -> {
//What to do?
});
尝试使用此代码
Marker lastOpenned = null;
mMap.setOnMarkerClickListener(new OnMarkerClickListener() {
public boolean onMarkerClick(Marker marker) {
// Check if there is an open info window
if (lastOpenned != null) {
// Close the info window
lastOpenned.hideInfoWindow();
// Is the marker the same marker that was already open
if (lastOpenned.equals(marker)) {
// Nullify the lastOpenned object
lastOpenned = null;
// Return so that the info window isn't openned again
return true;
}
}
// Open the info window for the marker
marker.showInfoWindow();
// Re-assign the last openned such that we can close it later
lastOpenned = marker;
// Event was handled by our code do not launch default behaviour.
return true;
}
});