標籤:size tar 10個 idt img tps gradient use log
最近朋友需要兩點路線和多個點路線繪製這個功能,幫忙弄了一下,寫這篇部落格與大家分享一下。
兩點路線
是起點和終點兩個經緯度點,高德繪製出路線,可以實現實線和虛線功能
:
相關屬性:
mPolylineOptions = new PolylineOptions(); mPolylineOptions.setDottedLine(true);//設定是否為虛線 mPolylineOptions.geodesic(false);//是否為大地曲線 mPolylineOptions.visible(true);//線段是否可見 mPolylineOptions.useGradient(false);//設定線段是否使用漸層色 //設定線顏色,寬度 mPolylineOptions.color(getWalkColor()).width(getRouteWidth());
多點路線
這個可以用來記錄行走軌跡,無數個座標點繪製路線
:(我測了10個點)
相關代碼:
//起點位置和 地圖介面大小控制 aMap.moveCamera(CameraUpdateFactory.newLatLngZoom(list.get(0), 7)); aMap.setMapTextZIndex(2); aMap.addPolyline((new PolylineOptions()) //手動資料測試 //.add(new LatLng(26.57, 106.71),new LatLng(26.14,105.55),new LatLng(26.58, 104.82), new LatLng(30.67, 104.06)) //集合資料 .addAll(list) //線的寬度 .width(10).setDottedLine(true).geodesic(true) //顏色 .color(Color.argb(255,255,20,147)));
源碼地址下載:https://github.com/DickyQie/android-gaode-map
android-------高德地圖兩點路線和多個點路線繪製