【发布时间】:2019-07-26 11:24:04
【问题描述】:
我从 firestore 检索坐标并将它们保存在一个 latlng 列表数组中。
然后使用 for 循环,我将列表数组中的元素填充到 PolygonOptions 变量中。 调试显示所有数据都在应有的位置,但无法在地图上绘制多边形
这是我尝试过的
private void DrawPolygon(List<LatLng> array) {
int length = array.size();
if(length == 0)
{
// Do whatever you like then get out. Do not run the following.
return;
}
PolygonOptions poly = new PolygonOptions();
for (int i = 0; i < length; i++) {
LatLng latLong = new LatLng(array.get(i).latitude,
array.get(i).longitude);
poly.add(latLong);
}
Polygon polygon = mMap.addPolygon(poly);
`
应用程序没有显示任何错误
【问题讨论】: