0

The first time i write android project. And I face a problem is that. I have get the source and destination information from PlaceAutocompleteFragement. However, I don't know how to draw them in a map. I have saw some article like drawing a path in map through 2 place, but most of time is mark the point directly by clicking a place in a map instead of getting the place from textbox. Can anyone help me. Thank a lot.

4

1 回答 1

0

看看这个,

谷歌地图初始化后,获取两个位置之间的 Latlngs 列表,然后将这些 Latlngs 添加到谷歌地图中,​​如下所示。

PolylineOptions options = new 
PolylineOptions().width(5).color(Color.BLUE).geodesic(true);
for (int z = 0; z < latLnglist.size(); z++) {
LatLng point = latLnglist.get(z);
options.add(point);
}
line = myMap.addPolyline(options);
于 2018-04-19T04:48:19.730 回答