【问题标题】:Change radius of circle on distance change在距离变化时改变圆的半径
【发布时间】:2018-07-26 05:21:50
【问题描述】:

我正在实施谷歌地图,用户可以在其中设置距离(例如 10 公里或 15 公里)。基于公里距离圈/地图中的标记应该改变。

【问题讨论】:

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


    【解决方案1】:
            if (circle != null) circle.setRadius(0); return;
            double radius = 1000 * range;//range would be in meters
            if (circle != null) {
                circle.setCenter(mMap.getCameraPosition().target);
                circle.setRadius(radius);
            } else {
                circle = mMap.addCircle(new CircleOptions()
                        .center(mMap.getCameraPosition().target)
                        .radius(radius)
                        .strokeWidth(5f)
                        .strokeColor(0x80ED1F29)
                        .fillColor(0x1A00B200));
            }
    

    注意:范围=以米为单位的半径,圆将是全局变量

    【讨论】:

      猜你喜欢
      • 2016-03-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多