boundCenter()/boundCenterBottom()对于 ItemizedOverlay 中的标记是必需的吗?
除非您在默认标记上调用 boundCenter()
或 boundCenterBottom()
,否则 ItemizedOverlay
中的标记似乎不会显示在地图中。
这是正确的吗?如果是,为什么?是不是默认情况下根本没有设置 (0,0) 点,因此 Android 不知道如何放置标记?
更新:
我发现您也有 Drawable.setBounds(),因此我假设 boundCenter()
和 boundCenterBottom()
正在调用此方法。如何决定将 Drawable 的哪一部分用作地图上的定位点?
It seems that markers in an ItemizedOverlay
are not shown in the map unless you call boundCenter()
or boundCenterBottom()
on the default marker.
Is this correct, and if so, why? Is it that a (0,0) point is not set at all by default, and thus Android has no idea how to place the markers?
Update:
I see that you also have Drawable.setBounds(), so I assume boundCenter()
and boundCenterBottom()
is calling this method. How is it decided which part of the Drawable is used as the pin point on the map?
请参阅此示例了解如何使用
boundCenter( )
我相信为了使boundCenter()调用起作用,你的Drawable应该有一些固有的宽度和高度。我猜它的工作原理是这样的:
这偏移了从上/左到下/中心的边界。
See this example of how to use the
boundCenter()
I believe for the boundCenter() call to work, your Drawable should have some intrinsic width and height. I'm guessing it works something like this:
This offsets the bounds from Top/Left, to Bottom/Center.