根据详细的经纬度绘制:两个经纬度位置之间用一条直线连接,多条直线连接在一起近似于轨迹 //List list;//路径、起点、终点BitmapDescriptor trace = BitmapDescriptorFactory.fromResource(R.mipmap.trac
//Listlist; //路径、起点、终点 BitmapDescriptor trace = BitmapDescriptorFactory.fromResource(R.mipmap.trace); BitmapDescriptor start = BitmapDescriptorFactory.fromResource(R.mipmap.start); BitmapDescriptor end = BitmapDescriptorFactory.fromResource(R.mipmap.end); if (list.size() > 0) { //添加起点、终点 OverlayOptions startOptions = new MarkerOptions().position(list.get(0)).icon(start); OverlayOptions endOptions = new MarkerOptions().position(list.get(list.size() - 1)).icon(end); mBaiduMap.addOverlay(startOptions); mBaiduMap.addOverlay(endOptions); } //绘制直线 PolylineOptions polylineOptions = new PolylineOptions().width(20).customTexture(trace).points(list).dottedLine(false); mBaiduMap.addOverlay(polylineOptions);