android

您所在的位置:网站首页 高德导航多条路线 android

android

2024-05-24 07:24| 来源: 网络整理| 查看: 265

最近朋友需要两点路线和多个点路线绘制这个功能,帮忙弄了一下,写这篇博客与大家分享一下。

两点路线

是起点和终点两个经纬度点,高德绘制出路线,可以实现实线和虚线功能

效果图:

      

 

相关属性:

 

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

 

 

 

 



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3