android 自定义地图标注,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方法里處理標記提示信息具體的內容,包括顯示人名、點擊事件等等。
總結
以上是生活随笔為你收集整理的android 自定义地图标注,Android中调用高德地图的自定义标记视图的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 手游自动挂机脚本开发历程
- 下一篇: webstorm中文版修改