【问题标题】:Android map overlay exact coordinatesAndroid地图叠加精确坐标
【发布时间】:2012-05-22 06:22:24
【问题描述】:

我将图像作为叠加层放在 Android 谷歌地图上。图像是否在坐标处对齐图像的原点?有没有办法控制它?如果我希望图像的中心位于叠加坐标处,我该怎么做?

非常感谢

【问题讨论】:

    标签: android map overlay


    【解决方案1】:
    //This will make the center of the image to be at the coordinates.
    
    public abstract class CustomOverlay<Item extends OverlayItem> extends ItemizedOverlay<Item> {
    
    public CustomOverlay(Drawable defaultMarker, MapView mapView) {
        super(boundCenter(defaultMarker), mapView); 
        .
        .
        .
    
    }
    

    【讨论】:

    • 谢谢。它工作完美。我注意到的一件事是 boundCenter 仅适用于默认标记。如果我使用 overlayitem.setMarker(anotherImage); 更改标记图像在 (0,0) 处对齐。非常感谢你。它解决了我的问题。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-01-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-05
    • 1970-01-01
    相关资源
    最近更新 更多