最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

java - How to put labels under Polygon? - Stack Overflow

programmeradmin7浏览0评论

I'm working on an Android app that uses the Google Map. I have large Polygon that hides the map. But the labels are above of this but I want them under my Polygon. I do not want to turn off labels.

how the labels look above the polygon

I can set the labels' color to black to "hide" them but this changes the labels that is not under the Polygon

the map with black labels

this is how I add the polygon to the map:

hidePolygon = myMap.addPolygon(new PolygonOptions()
        .addAll(points)
        .strokeColor(Color.rgb(218, 112, 214))

                .zIndex(100f)
        .fillColor(0xFF000000));

my gmap style json:

[
  {
    "featureType": "all",
    "elementType": "labels",
    "stylers": [
      {
        "weight": "0.01"
      }
    ]
  },
  {
    "featureType": "all",
    "elementType": "labels.text",
    "stylers": [
      {
        "visibility": "off"
      }
    ]
  },
  {
    "featureType": "all",
    "elementType": "labels.text.fill",
    "stylers": [
      {
        "visibility": "on"
      },
      {
        "saturation": "100"
      },
      {
        "lightness": "-100"
      },
      {
        "gamma": "0.00"
      },
      {
        "color": "#000000"
      }
    ]
  },
  {
    "featureType": "all",
    "elementType": "labels.text.stroke",
    "stylers": [
      {
        "visibility": "on"
      },
      {
        "color": "#000000"
      },
      {
        "saturation": "-48"
      },
      {
        "lightness": "-75"
      },
      {
        "gamma": "4.80"
      }
    ]
  },
  {
    "featureType": "all",
    "elementType": "labels.icon",
    "stylers": [
      {
        "saturation": "-100"
      },
      {
        "visibility": "on"
      },
      {
        "lightness": "-100"
      },
      {
        "color": "#000000"
      }
    ]
  },
  {
    "featureType": "landscape.man_made",
    "elementType": "labels",
    "stylers": [
      {
        "weight": "2.59"
      }
    ]
  }
]
发布评论

评论列表(0)

  1. 暂无评论