Marker Image Drawable change GoogleMap V2

给你一囗甜甜゛ 提交于 2020-02-08 06:49:11

问题


I have added markers in google map control using google map api v2 version but How to change Marker Background image when marker click event.

@Override
    public boolean onMarkerClick(Marker arg0) {
arg0.setIcon  //Not show in List setIcon method Google API V2 Version
        return false;
    }

回答1:


Override map onMarkerClick() and change icon for the marker clicked.

private Marker changedMarker = null;

@Override
public boolean onMarkerClick(Marker marker) {
    if(changedMarker != null) {
        changedMarker.setIcon(defaultIcon);    // sets default icon
        changedMarker = null;
    }
    marker.setIcon(icon);    // icon is the Bitmap you want
    changedMarker = marker;
    return true;
}


来源:https://stackoverflow.com/questions/23054166/marker-image-drawable-change-googlemap-v2

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