I use BalloonItemizedOverlay. How to show balloon under the marker? (It is from the center of a marker by default.)

有帮助吗?

解决方案

If you're using this one you have the method

public void setBalloonBottomOffset(int pixels)

Set the horizontal distance between the marker and the bottom of the information balloon. The default is 0 which works well for center bounded markers. If your marker is center-bottom bounded, call this before adding overlay items to ensure the balloon hovers exactly above the marker.

So, if you have a marker that has the usual V at the bottom, defining the point where it touches the map, you need to set an offset of half it's height BEFORE you add it to the overlays.

Example:

 -----    ^
|     |   |
|     |  20 px  of height, you need to do marker.setBalloonBottomOffset(-10)
 -- --    |
   V      v
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top