Dismiss info-window in android google map after click info-window?
-
02-01-2020 - |
質問
Hi I want to dismiss android Google map info-window when I clicked info-window.Normally when I clicked map it dismiss.But I also need when user click the info-window then also dismiss info-window.
@Override
public void onInfoWindowClick(Marker marker) {
// dismiss info-window
}
I want to know is there way to dismiss after i clicked info-window in android. Thanks Sajith
解決
You'll need to set the GoogleMap's Info Window Click Listener, best done in your 'onCreate'. Easiest to just make the Activity/Fragment implment GoogleMap.OnInfoWindowClickListener.
map.setOnInfoWindowClickListener(this);
Then set up your listener method and just call 'marker.hideInfoWindow();'.
@Override
public void onInfoWindowClick(Marker marker) {
marker.hideInfoWindow();
}
That should do it.
所属していません StackOverflow