【问题标题】:osmdroid ItemizedOverlay error: The method boundCenterBottom(Drawable) is undefined for the typeosmdroid ItemizedOverlay 错误:该类型未定义方法 boundCenterBottom(Drawable)
【发布时间】:2012-03-12 12:42:46
【问题描述】:

我已经为这个问题苦苦挣扎了几个小时:

我正在尝试让我的 itemizedoverlay 工作,但我不断收到此错误:

The method boundCenterBottom(Drawable) is undefined for the type 

我的班级:

    public MyDynamicItemizedOverlay(Drawable defaultMarker) {
        super(boundCenterBottom(defaultMarker));

        items = new ArrayList<OverlayItem>();
        populate();

    }

    public void addNewItem(GeoPoint location, String markerText,
            String snippet) {
        items.add(new OverlayItem(snippet, markerText, location));
        populate();
    }

    public void removeItem(int index) {
        items.remove(index);
        populate();
    }

    @Override
    protected OverlayItem createItem(int index) {
        return items.get(index);
    }

    @Override
    public int size() {
        return items.size();
    }

    @Override
    public boolean onSnapToItem(int arg0, int arg1, Point arg2,
            IMapView arg3) {
        // TODO Auto-generated method stub
        return false;
    }

}

我正在使用 osmdroid-android-3.0.8 和 3.0.7(都试过了)。 ItemizedOverlay 实际上似乎没有这样的构造函数,但我能够谷歌搜索的所有样本都遵循相同的模式......

【问题讨论】:

  • 解决方法:将带有 boundCenterBottom 的行替换为 // super(boundCenterBottom(defaultMarker));超级(defaultMarker,新 ResourceProxyImpl(getApplicationContext())); - 根本不使用缺少的方法..

标签: android android-mapview itemizedoverlay osmdroid


【解决方案1】:

好吧,看来我的问题的答案是这个方法没有在osmdroid中实现,并且:

item.setMarkerHotspot(HotspotPlace.BOTTOM_CENTER);

应该使用

【讨论】:

  • 亲爱的 Szymon。在尝试使 HelloGoogleMaps 示例与 OSMdroid 一起工作后,我的代码与您的代码非常相似。我收到与您相同的错误消息并替换了 super(boundCenterBottom(defaultMarker)); 行根据您的建议,但会引发错误“无法解析项目”和“隐式超级构造函数 ItemizedOverlay() 未定义。必须显式调用另一个构造函数”这里要使用的 setMarkerHotspot 方法究竟如何?
  • @birgit:我认为您必须将yourPOIOverlayItem.setMarker(boundCenterBottom(yourMarker)); 替换为yourPOIOverlayItem.setMarkerHotspot(HotspotPlace.BOTTOM_CENTER); yourPOIOverlayItem.setMarker(yourMarker);
猜你喜欢
  • 1970-01-01
  • 2012-05-18
  • 1970-01-01
  • 2022-11-03
  • 2022-01-11
  • 2018-04-02
  • 1970-01-01
  • 2015-04-23
相关资源
最近更新 更多