Question

In APIv1 I was drawing markers like this:

    Drawable flag = getResources().getDrawable(R.drawable.flagfinish);
    flag.setBounds(0, -flag.getIntrinsicHeight(), flag.getIntrinsicWidth(), 0);

and it was working - left bottom corner of picture was in center of LatLng. But how could I draw something like this in APIv2? I tried this:

Marker hc = mMap.addMarker(new MarkerOptions()
        .position(HC)
        .title("Hlohovec")
        .snippet("Hlohovec")
        .icon(BitmapDescriptorFactory.fromResource(R.drawable.flagfinish)));

but this is moved to left (I want to draw a flag with pole on left so this doesn't pin it where I want).

Is there any possible way to do this? And I don't want to use GroundOverlayOptions because it is changing with zoom.

Thanks for any answers.

Was it helpful?

Solution

you need to change the Anchor position of the marker image when you create the marker

from the docs:

The point on the image that will be placed at the LatLng position of the marker. This defaults to the middle of the bottom of the image.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top