Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to draw the marker on the center of the polyline

I am working on google maps and location listener. I am drawing the polyline on the map with my movement using location listener. Now i want the starting point and the current position on the polyline. I am setting the customized icon as a marker but it appears on the left side of the polyline. I want it exact in the center and the ending point of the polyline. Any Solutions,,??

What i want

What is the problem

like image 617
Mudasir Sharif Avatar asked Dec 24 '22 23:12

Mudasir Sharif


2 Answers

In this case, you can set the marker anchor. mMap.addMarker(new MarkerOptions().anchor(0.5f, 0.5f).position(latLngArrayList.get(0)).icon(startPointIcon).title("Start"));

like image 74
Mudasir Sharif Avatar answered Jan 05 '23 17:01

Mudasir Sharif


Instead of using your image use marker provided by google which would solve your problem....Or else if you want custom marker with a pointy end...

like image 31
raasesh Avatar answered Jan 05 '23 17:01

raasesh