drag and drop icons to google map v2 android

2019-08-17 13:54发布

问题:

I'm using Google map v2 in my android project. I know that its possible to add custom markers as an icons as shown in the following code:

MarkerOptions marker= new MarkerOptions()
    .position(location)
    .icon(BitmapDescriptorFactory.
                     fromResource(R.drawable.map_marker_cab_pickup));

 map.addMarker( marker );

Is there are any possibility to move this icons by drag and drop to any location on the map?

回答1:

You are looking for MarkerOptions.draggable(true). Also check GoogleMap.OnMarkerDragListener , if you want to know when user drags your Marker.