是否可以从Android谷歌地图中删除默认的兴趣点 [英] is it possible to remove the default points of interest from Android google map

查看:125
本文介绍了是否可以从Android谷歌地图中删除默认的兴趣点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个Android应用程序,该应用程序将显示兴趣点Google地图, 我有自己的消息来源,因此我尝试删除Google地图显示的默认兴趣点(例如购物中心,公交车站等). 我已经在文档中搜索了解决方案,但未成功 有没有办法在Android上做到这一点?

I am developing an android application that would show Points of interest google map, i have my own sources so I am trying to remove the default points of interest(like malls,bus stops,...) that the google map show. i have searched the documentation for a solution and was unsuccessful is there a way to do it on android?

查看Google提供的蓝色巴士站

check out the blue bus stops that google provide

推荐答案

您现在可以隐藏它们!

You can hide them now!

新的Google Maps更新支持它: https://developers.google.com/maps/documentation/android-api/hiding-features

New google maps update supports it: https://developers.google.com/maps/documentation/android-api/hiding-features

这是实现它的方法:

@Override
public void onMapReady(GoogleMap googleMap) {
    mMap = googleMap;

    try {
        boolean success = mMap.setMapStyle(MapStyleOptions.loadRawResourceStyle(getContext(), R.raw.map_style));
        if (!success) {
            Log.e("MapsActivityRaw", "Style parsing failed.");
        }
    } catch (Resources.NotFoundException e) {
        Log.e("MapsActivityRaw", "Can't find style.", e);
    }
}

在原始目录中,您必须使用要使用的地图样式创建一个json文件.

In raw directory you have to create a json file with map style you want to use.

您不必自己编写此代码,可以使用Google创建的编辑器:

You don't have to write this yourself, you can use editor, which google created:

https://mapstyle.withgoogle.com

我不知道哪个版本引入了此功能,但是它至少适用于9.6.1.

I don't know which version introduced this feature, but it works at least for 9.6.1.

这篇关于是否可以从Android谷歌地图中删除默认的兴趣点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆