高德地图点击marker,infoWindow不显示问题
2017-03-15 10:29
881 查看
1)按照官网指示,要implement Amap.AMap.InfoWindowAdapter,override func:
@Override
public View getInfoWindow(Marker marker) {
// TextView title =(TextView)infoWindow.findViewById(R.id.title);
// title.setText(“lqteam”);
// TextView snippet =(TextView)infoWindow.findViewById(R.id.snippet);
// String str =”lqteam snippet”;
// snippet.setText(str);
render(marker,infoWindow);
return infoWindow;
}
@Override
public View getInfoContents(Marker marker) {
return null;
}
}
2)设置监听
aMap.setOnMarkerClickListener(this);
//实现 InfoWindow 样式和内容,必须要先执行如下方法:
aMap.setInfoWindowAdapter(this);//AMap类中
3)在marker的点击事件里, marker.showInfoWindow():
@Override
public boolean onMarkerClick(Marker marker) {
//调用 Marker 类的 showInfoWindow() 和 hideInfoWindow() 方法可以控制显示和隐藏。
System.out.println(“onMarkerClick”);
marker.showInfoWindow();
System.out.println(“onMarkerClick marker.showInfoWindow()”);
return true;
}
4)注意::添加maker的时候必须设置marker的title,不然是不会弹出infowindow的。
@Override
public View getInfoWindow(Marker marker) {
System.out.println("getInfoWindow"); View infoWindow = null; if (infoWindow == null) { infoWindow = LayoutInflater.from(this).inflate( R.layout.es_parent_popu, null); }
// TextView title =(TextView)infoWindow.findViewById(R.id.title);
// title.setText(“lqteam”);
// TextView snippet =(TextView)infoWindow.findViewById(R.id.snippet);
// String str =”lqteam snippet”;
// snippet.setText(str);
render(marker,infoWindow);
return infoWindow;
}
@Override
public View getInfoContents(Marker marker) {
return null;
}
}
2)设置监听
aMap.setOnMarkerClickListener(this);
//实现 InfoWindow 样式和内容,必须要先执行如下方法:
aMap.setInfoWindowAdapter(this);//AMap类中
3)在marker的点击事件里, marker.showInfoWindow():
@Override
public boolean onMarkerClick(Marker marker) {
//调用 Marker 类的 showInfoWindow() 和 hideInfoWindow() 方法可以控制显示和隐藏。
System.out.println(“onMarkerClick”);
marker.showInfoWindow();
System.out.println(“onMarkerClick marker.showInfoWindow()”);
return true;
}
4)注意::添加maker的时候必须设置marker的title,不然是不会弹出infowindow的。
相关文章推荐
- 高德地图自定义marker不显示的问题
- 高德地图自定义Marker点击时出现的InfoWindow
- 高德地图开发【覆盖物显示——Marker的使用(一)】
- 高德地图显示在fragment中并添加按钮点击事件
- mapabc高德地图显示多个点,并且每个marker点可以响应鼠标点击事件,处理跳转页面
- 记录帖:高德地图点击不出现infowindow的处理
- 高德地图不显示问题
- 高德地图的Marker不需要setMap,创建时默认就可以显示在地图上
- 高德 地图sdk中,自定义弹出框(气泡,对话框,InfoWindow,Marker)
- 高德地图设置的onMarkerClick点击监听事件返回值
- 高德地图开发【覆盖物显示——Marker的使用(一)】
- android map高德地图显示多个点,并且每个marker点可以响应鼠标点击事件,处理跳转页面
- 高德地图搜索以后生成的marker的点击事件
- 高德地图多个Marker标记自动缩放全部显示在屏幕中
- (转)高德地图多个Marker标记自动缩放全部显示在屏幕中
- 高德地图自定义marker的图片定位的问题
- 高德地图显示在fragment中并添加按钮点击事件
- 高德地图开发【覆盖物显示——Marker的使用(一)】
- 高德地图多个Marker标记自动缩放全部显示在屏幕中
- 高德地图自定义Marker显示文字