Android google maps marker disable navigation option

断了今生、忘了曾经 提交于 2019-12-18 10:18:30

问题


Im creating an app where users need to walk to a point on a map. But they need to find a route to the point by them selves. Ive created a map with markers but by default if a user clicks on the marker a "start navigation" and "view in google maps" option is shown. Is it possible to disable these options ?

The options that are shown on marker click


回答1:


This thing is called Map Toolbar. You can disable it by calling UiSettings.setMapToolbarEnabled(false):

GoogleMap map;
....... //init map

map.getUiSettings().setMapToolbarEnabled(false);



回答2:


You can also define setMapToolbarEnabled() from the XML using the following property:

map:uiMapToolbar="false"



回答3:


In kotlin you can do:

map.apply {
   uiSettings.isMapToolbarEnabled = false
}



回答4:


If anyone needs to do this in Google Maps v2, you set it in the map options instead of setting it on the map directly. So like this:

var mapOptions = new GoogleMapOptions().InvokeMapToolbarEnabled(false);



来源:https://stackoverflow.com/questions/30354258/android-google-maps-marker-disable-navigation-option

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