Is it possible to use OverlayItem.setMarker() with no shadow?

随声附和 提交于 2019-12-08 06:28:21

问题


I want to display different markers on my map. One solution I could find is to define a new overlay for each marker. But then I could find that it can be done easier with

OverlayItme.set Marker(Drawable marker);

using a single overlay. It works fine, but the markers are drawn with shadow and I would like to display the marker icon with no shadow, my original picture has no shadow, and I want to draw it as it is. is it possible? This is how I'm doing now:

markerpic = this.getResources().getDrawable(R.drawable.icon_map);
    markerpic.setBounds(0, 0, markerpic.getIntrinsicWidth(), markerpic.getIntrinsicHeight());

   GeoPoint gp = new GeoPoint((int)(lat*1E6), (int)(lng*1E6));

    overlayitem = new OverlayItem(gp, "Title", "Message");
        overlayitem.setMarker(markerpic);
        myoverlay.adOverlay(overlayitem);
        mapOverlay.add(myoverlay);

回答1:


I have created a subclass which extends ItemizedOverlay and override this in my class for removing the shadow:

public void draw(Canvas canvas, MapView mapView, boolean shadow)
    {
        if(!shadow)
        {
            super.draw(canvas, mapView, false);
        }
    }


来源:https://stackoverflow.com/questions/8971704/is-it-possible-to-use-overlayitem-setmarker-with-no-shadow

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!