How to display a moving track on Android device

我们两清 提交于 2019-12-03 00:35:13

There's a straightforward solution using the 2.0 Maps API. You'll get a nice smooth route line using three steps:

  1. create a list of LatLng points such as:

    List<LatLng> routePoints;
    
  2. Add the route points to the list (could/should be done in a loop):

    routePoints.add(mapPoint);
    
  3. Create a Polyline and feed it the list of LatLng points as such:

    Polyline route = map.addPolyline(new PolylineOptions()
      .width(_strokeWidth)
      .color(_pathColor)
      .geodesic(true)
      .zIndex(z));
    route.setPoints(routePoints);
    

Give it a try!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!