问题
In my app I have a MapFragment.
I do
map = mapFragment.getMap();
and after that add a marker in the event
onMapClick(LatLng point){
...
map.addMarker(new MarkerOptions()
.position(point)
.title(txt));
...
}
All this works perfectly. What I need is to know when the user keep long click on the marker I put on the map.
I made some handmade calculations in
onMapLongClick(LatLng point){
...
if((Math.abs(mrkrPos.latitude-point.latitude)<0.0005)&&(Math.abs(mrkrPos.longitude-point.longitude)<0.0005))
...
}
but this isn't obviously a fine way to do it, and it isn't very accurate (only works when zoom camera is at high levels on map)
回答1:
There is currently no long Click Listener for markers. see my question about this from a while ago
回答2:
Hey take a look at the solution i have given in other thread.
https://stackoverflow.com/a/42885588/3779042
来源:https://stackoverflow.com/questions/17372179/how-to-detect-long-click-on-googlemap-marker