简体   繁体   English

Android Google地图:隐藏标签和显示标记

[英]Android Google Maps: Hiding labels and showing markers

I want to develop an Android application where I present users with a map with some markers. 我想开发一个Android应用程序,我向用户展示带有一些标记的地图。 On the basis of a question they select a marker which is then evaluated as correct or wrong. 在一个问题的基础上,他们选择一个标记,然后评估为正确或错误。 Now the problems: 现在的问题:

This can be implemented with Google Maps Android API v2 : 这可以使用Google Maps Android API v2

  1. But problem is that I am not able to hide country, state or continent names. 但问题是我无法隐藏国家,州或大陆的名字。 That takes away the purpose of the game. 这剥夺了游戏的目的。 Can I blur out the names? 我可以模糊名字吗? Can I prevent zoom? 我可以防止缩放吗?

Using WebViews and Google Maps in WebView : WebView使用WebViews和Google Maps:

  1. Problem is that markers cannot be made clickable for this. 问题是不能使标记可点击。 How can I do this. 我怎样才能做到这一点。 Plus where is javascript coding done? 再加上javascript编码在哪里? Could I have tutorials for this? 我可以为此提供教程吗?

Using offline maps. 使用离线地图。

Is that a possibility. 这是一种可能性吗? Can I put markers on it, and know where user clicked? 我可以在上面放置标记,并知道用户点击的位置吗?

The application "Geography Learning Game" does it nicely, and it also has Google written at the bottom, so they are using Google maps only. 应用程序“地理学习游戏”做得很好,并且谷歌也写在底部,所以他们只使用谷歌地图。 http://goo.gl/obE1fB http://goo.gl/obE1fB

Answering any of the above will solve my problem. 回答上述任何一个问题都可以解决我的问题。 Please reply with code. 请回复代码。

I found an answer, and would love to help anyone who comes across this while browsing. 我找到了答案,并愿意帮助那些在浏览时遇到这种情况的人。

Country, continent etc names can't be hidden using Google Maps, so OpenStreetMaps overlay layer is to be used over Google Maps. 无法使用Google地图隐藏国家/地区,大陆等名称,因此OpenStreetMaps叠加层将用于Google地图。

So rest of the code remains same, just add an overlay. 所以其余代码保持不变,只需添加叠加层即可。 This selectively hides what has to be hidden. 这有选择地隐藏了必须隐藏的内容。

Refer to https://code.google.com/p/osmdroid/ for the procedure to implement this. 有关实施此操作的过程,请参阅https://code.google.com/p/osmdroid/

Hope it helps! 希望能帮助到你!

You can customize your map by applying map style using GoogleMap.setMapStyle(MapStyleOptions) (method reference) . 您可以使用GoogleMap.setMapStyle(MapStyleOptions) (方法参考)应用地图样式来自定义地图。 You can create map style here (just move 'labels' progress bar to customize map labels). 您可以在此处创建地图样式(只需移动'标签'进度条以自定义地图标签)。 Copy map style json and create raw resource with its content. 复制地图样式json并使用其内容创建原始资源

Your onMapReady will look like this: 你的onMapReady将如下所示:

override fun onMapReady(googleMap: GoogleMap) {
    try {
        googleMap.setMapStyle(
                MapStyleOptions.loadRawResourceStyle(context, R.raw.map_without_labels_style)
        )
    } catch (e: Resources.NotFoundException) {
        // log it
    }
}

More information could be found here 更多信息可以在这里找到

I'm not 100% sure but the app you referenced might be using Google Enterprise maps. 我不是百分百确定,但您引用的应用可能正在使用Google Enterprise地图。 You will have to look into that here http://www.google.com/enterprise/mapsearth/ . 您必须在http://www.google.com/enterprise/mapsearth/上查看

However you might be able to set the map type to satellite to remove labels. 但是,您可以将地图类型设置为satellite以删除标签。 I don't know any clear way to blur the map labels. 我不知道任何模糊地图标签的明确方法。

googleMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);

To Disable Zoom you can do the following. 要禁用缩放,您可以执行以下操作。

googleMap.getUiSettings().setZoomControlsEnabled(false);
googleMap.getUiSettings().setZoomGesturesEnabled(false);

As for the webview someone else will need to answer that. 至于webview,其他人需要回答这个问题。

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

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