Reputation: 4460
How can I disable onClicklistener for GoogleMap, GoogleMap’s setOnMapClickListener()
method, like we have setClickable(true)/setClickable(false) for other android widgets.
Upvotes: 1
Views: 1210
Reputation: 2583
There are some methods of GoogleMap api like
googleMap.getUiSettings().setScrollGesturesEnabled(false);
but those will not work in this case you better go with this implementation
if(null!=googleMap){
googleMap(new GoogleMap.OnMapClickListener() {
@Override
public void onMapClick(LatLng latlng) {
if(your validation) {
//if true then go to Google map.
}
else {
// if false then don't go to Google map.
}
}
});
}
Upvotes: 1
Reputation: 2525
To Disable ScrollGesture:
mMap.getUiSettings().setScrollGesturesEnabled(false);
To Disable All the Gesture, Use below code:
mMap.getUiSettings().setAllGesturesEnabled(false);
And To Disable MapToolbar, Use:
mMap.getUiSettings().setMapToolbarEnabled(false);
Upvotes: 0
Reputation:
try mMapFragment.getView().setClickable(false);
or
yourmap.getUiSettings().setAllGesturesEnabled(false);
Upvotes: 0