首先给出官方api上关于 marker和 infowindow的自定义方法:
aMap.setOnMarkerClickListener(this);// 设置点击marker事件监听器
aMap.setInfoWindowAdapter(this);// 设置自定义InfoWindow样式
<span style="font-size:18px;">/**
* 监听自定义infowindow窗口的infocontents事件回调
*/
@Override
public View getInfoContents(Marker marker) {
if (radioOption.getCheckedRadioButtonId() != R.id.custom_info_contents) {
return null;
}
View infoContent = getLayoutInflater().inflate(
R.layout.custom_info_contents, null);
render(marker, infoContent);
return infoContent;
}
/**
* 监听自定义infowindow窗口的infowindow事件回调
*/
@Override
public View getInfoWindow(Marker marker) {
if (radioOption.getCheckedRadioButtonId() !&