有什么方法可以在我放大和缩小 Google Maps V2 时自动增加和减少多段线的宽度?
当它仍然非常薄时,它看起来很糟糕,尤其是在较新的设备上。但是当缩小时你需要它那么薄。
最佳答案
添加到 map 时保存折线。然后对折线执行操作。
添加到 map 时将折线保存到数组列表的示例。
polylines = new ArrayList<Polyline>();
protected void onProgressUpdate(PolylineOptions... progress) {
if (isCancelled()) {
return;
}
if (progress[0] != null) {
// add the poly line to the map
// save the polyline for later user
if (mMap != null) {
polylines.add(mMap.addPolyline(progress[0]));
}
}
}
同时回到代码中对折线进行操作
polylines.get(0).setWidth(width)
或
for (Polyline po: polylines){
po.setWidth(newWidth);
}
关于Android 通过缩放级别增加多段线宽度(谷歌地图 V2),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25772999/