【问题标题】:Android increase polyline width by zoom level (Google Maps V2)Android通过缩放级别增加折线宽度(谷歌地图V2)
【发布时间】:2014-11-04 13:11:43
【问题描述】:

当我在 Google Maps V2 上放大和缩小时,有没有一种方法可以自动增加和减少折线的宽度?

当它保持如此纤薄时,它看起来很可怕,尤其是在较新的设备上。但是缩小时你需要它那么薄。

【问题讨论】:

    标签: android google-maps-android-api-2 polyline


    【解决方案1】:

    将折线添加到地图后保存。然后对折线执行操作。

    添加到地图时将折线保存到数组列表的示例。

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

    【讨论】:

    • 你自己的缩放代码 mMap.setOnCameraChangeListener(listener)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-21
    • 1970-01-01
    • 2012-09-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多