ItemizedOverlay
中的标记似乎不会显示在 map 中,除非您在默认情况下调用 boundCenter()
或 boundCenterBottom()
标记。
这是正确的吗?如果是,为什么?是不是默认没有设置(0,0)点,Android不知道怎么放标记?
更新:
我看到您还有 Drawable.setBounds(),所以我假设 boundCenter()
和 boundCenterBottom()
正在调用此方法。如何决定Drawable的哪一部分作为 map 上的针点?
最佳答案
参见 this example如何使用 boundCenter()
我相信要使 boundCenter() 调用起作用,您的 Drawable 应该具有一些固有的宽度和高度。我猜它的工作原理是这样的:
public static Drawable boundCenter(Drawable d)
{
d.setBounds(d.getIntrinsicWidth() /- 2, d.getIntrinsicHeight() / -2,
d.getIntrinsicWidth / 2, d.getIntrinsicHeight() / 2);
return d;
}
这会将边界从顶部/左侧偏移到底部/中心。
关于android - boundCenter()/boundCenterBottom() 必须用于 ItemizedOverlay 中的标记?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5432712/