高德地图 android 设置完全自定义的InfoWindow

本文介绍了如何在高德地图Android SDK中实现完全自定义的InfoWindow。通过设置OnMarkerClickListener和InfoWindowAdapter,可以自定义InfoWindow样式。关键在于,在自定义的View布局XML文件中将最外层布局背景设为透明,以此去除高德默认的气泡框,达到完全定制的效果。
摘要由CSDN通过智能技术生成

首先给出官方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() !&
评论 16
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值