Mudasir Sharif
Mudasir Sharif

Reputation: 731

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

Upvotes: 5

Views: 2501

Answers (4)

Mudasir Sharif
Mudasir Sharif

Reputation: 731

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"));

Upvotes: 7

Ready Android
Ready Android

Reputation: 3622

Issue with polyline draws for outdoor latlngs and your markers latlngs are for indoor position. Change your maker positions with outdoor street positions and it will work.

Upvotes: 0

Varma460
Varma460

Reputation: 507

Check this :

http://android-er.blogspot.in/2013/01/google-maps-android-api-v2-example_5213.html

hope it will help you.

According to Marker , your maker is not designed properly, you should design marker in must a way that i comes over the point..

enter image description here this is the reason they keep marker in this shape

Upvotes: 2

raasesh
raasesh

Reputation: 161

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...

Upvotes: 2

Related Questions