Android中调用高德地图的自定义标记视图


1、在api中的MarkerDemoActivity是标记类,先初始化Amap对象init()、setUpMap(),再去定位(定位可以仿高德的api,也可以查查Android自带的定位方法)
 
2、得到经纬度后,在获取需要标记的坐标,在drawMarkers()里添加需要标记的点

 aMap.addMarker(new MarkerOptions().position(mList.get(i)).snippet(myFans.get(i).getNickname()).icon(BitmapDescriptorFactory.defaultMarker()));
 
3、可以设置窗口模式,再点击标记后自动回调getInfoWindow()、getInfoContents(),如果需要自定义显示图像可以在这两个方法里调用render(marker, mWindow);,同时需要在CustomInfoWindowAdapter()里加入需要显示的布局view    CustomInfoWindowAdapter() {
 
mWindow = getLayoutInflater().inflate(R.layout.custom_info_window, null);
 
mContents = getLayoutInflater().inflate(R.layout.custom_info_contents, null);
 
// mOptions = (RadioGroup)
 
// findViewById(R.id.custom_info_window_options);
 
}
 
在render方法里处理标记提示信息具体的内容,包括显示人名、点击事件等等。

相关内容

    暂无相关文章