简体   繁体   English

Android谷歌地图标记禁用导航选项

[英]Android google maps marker disable navigation option

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 标记点击时显示的选项

This thing is called Map Toolbar . 这个东西叫做地图工具栏 You can disable it by calling UiSettings.setMapToolbarEnabled(false) : 您可以通过调用UiSettings.setMapToolbarEnabled(false)来禁用它:

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

map.getUiSettings().setMapToolbarEnabled(false);

您还可以使用以下属性从XML定义setMapToolbarEnabled()

map:uiMapToolbar="false"

In kotlin you can do: 在kotlin你可以做:

map.apply {
   uiSettings.isMapToolbarEnabled = false
}

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. 如果有人需要在Google Maps v2中执行此操作,则可以在地图选项中进行设置,而不是直接在地图上设置。 So like this: 像这样:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM