I need to draw circle of some radius on some given location that can be dragged to some other point on map I can well draw circle like this
mMap.addCircle(new CircleOptions().center(circleLocation).radius(10).strokeColor(Color.RED).fillColor(Color.RED));
Now I need to drag this circle on map in such a way that when I click on this circle map gets locked and on moving my finger this circle should move on circle and not map itself
Thanks in advance!!!
I don't know how to do with shapes but one alternative is to use a marker. It doesn't have the exact result as the marker is drawn flush to the screen view rather than flush to the map but it does have built in drag support. You would need to create a circle image.
map.addMarker(new MarkerOptions()
.position(MELBOURNE)
.title("Melbourne")
.draggable(true)
.icon(BitmapDescriptorFactory.fromResource(R.drawable.circle)));
View above the SupportMapFragmentOnTouchListener to this ViewProjection to convert x,y to LatLng and Location.distanceBeetweenfalse to give map chance to handle eventtrue and save relevant variablesProjection to calculate new center based on initial and new x,yIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With