【发布时间】:2014-11-04 13:11:43
【问题描述】:
当我在 Google Maps V2 上放大和缩小时,有没有一种方法可以自动增加和减少折线的宽度?
当它保持如此纤薄时,它看起来很可怕,尤其是在较新的设备上。但是缩小时你需要它那么薄。
【问题讨论】:
标签: android google-maps-android-api-2 polyline
当我在 Google Maps V2 上放大和缩小时,有没有一种方法可以自动增加和减少折线的宽度?
当它保持如此纤薄时,它看起来很可怕,尤其是在较新的设备上。但是缩小时你需要它那么薄。
【问题讨论】:
标签: android google-maps-android-api-2 polyline
将折线添加到地图后保存。然后对折线执行操作。
添加到地图时将折线保存到数组列表的示例。
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);
}
【讨论】: