我正在尝试为地图设置样式,但文本不可见http://joxi.ru/RmzoN4DFR00d82。我需要在上面显示白色文本。这是我正在尝试的方法,但是没有运气
{
"featureType": "road.highway",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#FFFFFF"
}
]
}
我建议您使用Google的Styling Wizard。要更改高速公路标签的文本颜色,您可以使用以下样式作为示例:
[
{
"featureType": "road.highway",
"elementType": "geometry.fill",
"stylers": [
{
"color": "#a1a1a1"
},
{
"visibility": "on"
}
]
},
{
"featureType": "road.highway",
"elementType": "labels.icon",
"stylers": [
{
"visibility": "on"
}
]
},
{
"featureType": "road.highway",
"elementType": "labels.text",
"stylers": [
{
"color": "#ffffff"
}
]
},
{
"featureType": "road.highway",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#ffffff"
}
]
},
{
"featureType": "road.highway",
"elementType": "labels.text.stroke",
"stylers": [
{
"visibility": "off"
}
]
}
]
从我在屏幕快照中看到的结果来看,问题可能在于您正在向图标添加颜色,从而覆盖了其中的文本内容(无法设置样式)。因此,请确保按照上述代码避免这种情况。
希望这对您有帮助!