Centering bitmap Marker (Google Maps Android API v2)

前端 未结 2 525
误落风尘
误落风尘 2021-02-01 12:19

When I add a marker from a custom Bitmap, the marker is not centered at the point I specify.

I\'m adding it like this:

    // ID tramo
    final int tram         


        
2条回答
  •  闹比i
    闹比i (楼主)
    2021-02-01 12:55

    Simply set anchor point for you marker to 0.5 and 0.5 (middle of your icon).

    ...
    MarkerOptions m = new MarkerOptions();
    m.anchor(0.5f, 0.5f);
    ...
    

    The default anchor value is (0.5f, 1.0f). You can read about marker here.

提交回复
热议问题