Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - Dragging marker without having to hold in map api v2

I'm implementing a feature in my app that allows user to manually locate themselves on a map. So I use a pin to represent their location and let user drag it to the place they currently are. The simple solution is to use setDraggable(true) on the marker, but this requires users to hold the marker for 3 or 5 seconds until it is draggable. I think this is quite confusing for many user to use the feature. So, what I want is to make the dragging more responsive by letting users drag them immediately without having to hold it for a while - like how Foursquare does!

enter image description here

What should I do to implement my own dragging feature? If you have any suggestions, please help me and thanks.

like image 247
huong Avatar asked Aug 08 '13 16:08

huong


1 Answers

Check out the Hailo application. They have a neat workaround for this. It only works when you have one marker to drag.

The trick is to pan the map, instead of moving the marker. They just keep the marker in a view on top of the MapFragment (it's not actually a Marker on the map).

You can then use the map's cameraPosition.target as the location of your marker.

like image 172
Chris Broadfoot Avatar answered Oct 18 '22 10:10

Chris Broadfoot