gpt4 book ai didi

android - 当我单击 android 谷歌地图上的标记时如何隐藏 "Navigation"和 "GPS Pointer"按钮

转载 作者:IT老高 更新时间:2023-10-28 13:08:53 25 4
gpt4 key购买 nike

当我点击谷歌地图上的标记时,会出现“导航”和“GPS 指针”按钮。如何在 Android 开发中以编程方式隐藏这两个导航按钮?

enter image description here

最佳答案

对于您用红色勾勒的按钮组,您可以使用 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

关于android - 当我单击 android 谷歌地图上的标记时如何隐藏 "Navigation"和 "GPS Pointer"按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30430664/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com