Android高德地图如何修改InfoWindow的背景图片.

xiaoxiao2021-02-28  95

1.重写InfoWindow的适配器方法

aMap.setInfoWindowAdapter(new AMap.InfoWindowAdapter() { @Override public View getInfoWindow(Marker marker) { View infowindow = LayoutInflater.from(DreamBlueMonitorActivity.this) .inflate(R.layout.inforwindow_layout, null);//InfoWindow的的背景布局文件. //重新设置InfoWindow里的数据. TextView textView=(TextView) infowindow.findViewById(R.id.tc); textView.setText("船号:"+shipNo); return infowindow; } @Override public View getInfoContents(Marker marker) { return null; } });

2.在背景布局文件里   要将infoWindow的背景图片作为Background设置在布局文件的最外层布局里.

转载请注明原文地址: https://www.6miu.com/read-30606.html

最新回复(0)