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

笑着哭i 提交于 2019-11-26 15:43:52

问题


When I click the marker on the google map, "Navigation" and "GPS Pointer" buttons come out.How can I hide those two buttons programatically in android development?


回答1:


For the button group you have outlined in red, you can disable it using the setMapToolbarEnabled() method in UISettings.

From the documentation:

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'.

Code example to disable the two buttons with Java:

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

Just in case you were also wondering about the zoom buttons, you can disable them like this with Java:

mMap.getUiSettings().setZoomControlsEnabled(false);

In Kotlin you can use property access syntax:

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


来源:https://stackoverflow.com/questions/30430664/how-to-hide-navigation-and-gps-pointer-buttons-when-i-click-the-marker-on-th

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!