我有一个包含 Google Maps api v2 的 Android 应用程序。但是,有很多带有公共汽车/地铁/火车站等的图标,我不想出现在我的应用程序中。是否有可能删除/隐藏此图标?
3 回答
您现在可以使用样式删除标签和兴趣点 - 可在 2016 年 9 月版的 Google Maps Android API 中使用。
在此处查看有关如何执行此操作的指南: https ://developers.google.com/maps/documentation/android-api/hiding-features
请参阅此处的发行说明: https ://developers.google.com/maps/documentation/android-api/releases#september_21_2016
I'm using play-services-maps:12.0.1
You can create your own style in this page.
Once it is done, click finish and copy the JSON. After that, replace this JSON in maps_style_json file in your android project.
Example:
[
{
"featureType": "administrative",
"elementType": "geometry",
"stylers": [
{
"visibility": "off"
}
]
},
{
"featureType": "poi",
"stylers": [
{
"visibility": "off"
}
]
},
{
"featureType": "road",
"stylers": [
{
"visibility": "on"
}
]
},
{
"featureType": "road",
"elementType": "labels.icon",
"stylers": [
{
"visibility": "off"
}
]
},
{
"featureType": "transit",
"stylers": [
{
"visibility": "off"
}
]
}
]
This JSON deletes the landmarks and the labels, and just keeps the roads.
在撰写本文时(3.2.65)无法删除这些符号,但已经在gmaps-api-issues #4841上请求了它。