如何在Android中显示没有标签或街道名称的谷歌地图?

问题描述 投票:2回答:2

我正在开发一个Android应用程序,其中地图应该是干净的,并且不能显示街道名称或地点名称。我想在不同的位置自定义地图布局和样式并设置优惠。

android google-maps
2个回答
3
投票

from this site you can create custom map style

当你进入地图准备回调时,你可以像这样设置自定义地图样式

  @Override
    public void onMapReady(GoogleMap googleMap) {

        try {
            // Customise the styling of the base map using a JSON object defined
            // in a raw resource file.
            boolean success = googleMap.setMapStyle(
                    MapStyleOptions.loadRawResourceStyle(
                            this, R.raw.style_json));

            if (!success) {
                Log.e(TAG, "Style parsing failed.");
            }
        } catch (Resources.NotFoundException e) {
            Log.e(TAG, "Can't find style. Error: ", e);
        }

    }

0
投票

如果要自定义地图视图,可以为地图创建自定义样式。

googleMap.setMapStyle(
                    MapStyleOptions.loadRawResourceStyle(
                            this, R.raw.style_json));

请查看以下链接以供参考。

https://developers.google.com/maps/documentation/android-sdk/hiding-features

© www.soinside.com 2019 - 2024. All rights reserved.