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方法里处理标记提示信息具体的内容,包括显示人名、点击事件等等。

0b1331709591d260c1c78e86d0c51c18.png

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐