我目前正在编码GeoJson层,标记在正确的纬度和经度上显示良好。但是,如果单击标记,则不会显示添加的特性。
{
"type": "FeatureCollection",
"features":
[
{
"type": "Feature",
"properties":
{
"marker-color": "#7e7e7e",
"marker-size": "medium",
"marker-symbol": "",
"title": "this is a test marker"
},
"geometry":
{
"type": "Point",
"coordinates":
[
-0.07659316062927246,
51.50809472930477
]
}
}
]
}
上面是我尝试使用的GeoJson代码的示例,该点显示在正确的位置,但当我单击标记或任何其他方式时,它不会显示标题。
有人有什么建议吗?
您需要将infoWindow作为java代码分别用于每个标记,即使您正在编写GeoJson。
来自官方网站的示例代码:
static final LatLng MELBOURNE = new LatLng(-37.81319, 144.96298);
Marker melbourne = mMap.addMarker(new MarkerOptions()
.position(MELBOURNE)
.title("Melbourne"));
melbourne.showInfoWindow();
要自定义信息窗口,请参阅本教程。