Drawing a line/path on Google Maps

后端 未结 13 1079
执笔经年
执笔经年 2020-11-22 05:23

I\'ve been busy for a long time finding out how to draw a line between two (GPS) points on the map in HelloMapView but with no luck.

Could anyone please tell me how

13条回答
  •  半阙折子戏
    2020-11-22 05:38

    It is really easy with Google Maps Android API v2

    Just copy the example from Developer documentation

    (of course you have to init your map first)

    GoogleMap map;
     // ... get a map.
     // Add a thin red line from London to New York.
     Polyline line = map.addPolyline(new PolylineOptions()
         .add(new LatLng(51.5, -0.1), new LatLng(40.7, -74.0))
         .width(5)
         .color(Color.RED));
    

提交回复
热议问题