Drawing a line/path on Google Maps

后端 未结 13 1024
执笔经年
执笔经年 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:23

    For those who really only want to draw a simple line - there is indeed also the short short version.

    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));
    

    from https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/model/Polyline

提交回复
热议问题