单击 android google 地图上的标记时如何隐藏 "Navigation" 和 "GPS Pointer" 按钮

How to hide "Navigation" and "GPS Pointer" buttons when I click the marker on the android google map

当我点击 google 地图上的标记时,会出现 "Navigation" 和 "GPS Pointer" 按钮。如何在 android 开发中以编程方式隐藏这两个导航按钮?

对于您用红色框出的按钮组,您可以使用 setMapToolbarEnabled() method in UISettings.

禁用它

来自文档:

Sets the preference for whether the Map Toolbar should be enabled or disabled. If enabled, users will see a bar with various context-dependent actions, including 'open this map in the Google Maps app' and 'find directions to the highlighted marker in the Google Maps app'.

使用 Java 禁用两个按钮的代码示例:

//Disable Map Toolbar:
mMap.getUiSettings().setMapToolbarEnabled(false);

以防万一你也对缩放按钮感到疑惑,你可以像这样禁用它们 Java:

mMap.getUiSettings().setZoomControlsEnabled(false);

在 Kotlin 中你可以使用 属性 访问语法:

mMap.uiSettings.isMapToolbarEnabled = false
mMap.uiSettings.isZoomControlsEnabled = false