Android OverlayItem.setMarker(): Change the marker for one item

家住魔仙堡 提交于 2019-12-05 04:52:47

A bounding rectangle needs to be specified for the Drawable:

//Create new marker
Drawable icon = this.getResources().getDrawable(R.drawable.marker);

//Set the bounding for the drawable
icon.setBounds(
    0 - icon.getIntrinsicWidth() / 2, 0 - icon.getIntrinsicHeight(), 
    icon.getIntrinsicWidth() / 2, 0);

//Set the new marker to the overlay
overlayItem.setMarker(icon);
Ankit Jain

I believe this would work:

public void addOverlay(final OverlayItem overlay)
    {
        creditOverlay.add(overlay);
        populate();
        boundCenter(customMarker);
    }

You will have to call boundCenter or boundCenterBottom while adding overlay in map overlay list. In SetMarker() just set the custom maker.

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