【问题标题】:Android google map markers circles (multiple overlay no cumulative opacity)Android 谷歌地图标记圆圈(多次叠加无累积不透明度)
【发布时间】:2019-07-26 16:24:22
【问题描述】:

我正在尝试添加多个标记,这些标记在某些情况下可能会彼此靠近。我正在尝试在它们周围添加圆圈 加圈代码

points.forEach { point ->
        googleMap.addCircle(
            CircleOptions()
                .center(point.location)
                .radius(10.toDouble())
                .strokeWidth(1f)
                .strokeColor(Color.RED)
                .fillColor(Color.argb(60, 255, 0, 0))
        )
    }

左:是我用我的代码得到的 ______________ 右:这是我需要的 https://i.stack.imgur.com/NSD1A.png 在android中甚至可能吗?

【问题讨论】:

标签: android google-maps kotlin marker


【解决方案1】:

我通过将 zindex 设置为 1 解决了这个问题:

final CircleOptions options = new CircleOptions();
options.center(new LatLng(geofence.getCenter().getLatitude(), geofence.getCenter().getLongitude()));
options.radius(geofence.maxDistance().getValue());
options.strokeColor(Color.RED);
options.strokePattern(Collections.singletonList(new Dot()));
options.zIndex(1f);

geofenceCircle = googleMap.addCircle(options);

我有自己的磁贴提供程序,但由于某种原因,zindex 为 0 不起作用。

根据谷歌:

Z-Index 绘制此图块叠加层的顺序 其他叠加层(包括 GroundOverlays、TileOverlays、Polylines 和 多边形但不是标记)。绘制具有较大 z-index 的叠加层 在具有较小 z 索引的叠加层上。叠加的顺序与 相同的 z-index 是任意的。默认 zIndex 为 0。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-02-18
    • 1970-01-01
    • 2015-12-07
    • 1970-01-01
    • 1970-01-01
    • 2012-02-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多