Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google maps 将样式化谷歌地图与Xamarin Android配合使用_Google Maps_Xamarin.android - Fatal编程技术网

Google maps 将样式化谷歌地图与Xamarin Android配合使用

Google maps 将样式化谷歌地图与Xamarin Android配合使用,google-maps,xamarin.android,Google Maps,Xamarin.android,有人知道如何在Xamarin android上使用谷歌地图吗?谷歌最近增加了从这里创建样式地图的功能,他们展示了如何使用它的示例 private void setSelectedStyle() { MapStyleOptions style; switch (mSelectedStyleId) { case R.string.style_label_retro: // Sets the retro style via raw resourc

有人知道如何在Xamarin android上使用谷歌地图吗?谷歌最近增加了从这里创建样式地图的功能,他们展示了如何使用它的示例

private void setSelectedStyle() {
    MapStyleOptions style;
    switch (mSelectedStyleId) {
        case R.string.style_label_retro:
            // Sets the retro style via raw resource JSON.
            style = MapStyleOptions.loadRawResourceStyle(this, R.raw.mapstyle_retro);
            break;
        case R.string.style_label_night:
            // Sets the night style via raw resource JSON.
            style = MapStyleOptions.loadRawResourceStyle(this, R.raw.mapstyle_night);
            break;
        case R.string.style_label_grayscale:
            // Sets the grayscale style via raw resource JSON.
            style = MapStyleOptions.loadRawResourceStyle(this, R.raw.mapstyle_grayscale);
            break;
        case R.string.style_label_no_pois_no_transit:
            // Sets the no POIs or transit style via JSON string.
            style = new MapStyleOptions("[" +
                    "  {" +
                    "    \"featureType\":\"poi.business\"," +
                    "    \"elementType\":\"all\"," +
                    "    \"stylers\":[" +
                    "      {" +
                    "        \"visibility\":\"off\"" +
                    "      }" +
                    "    ]" +
                    "  }," +
                    "  {" +
                    "    \"featureType\":\"transit\"," +
                    "    \"elementType\":\"all\"," +
                    "    \"stylers\":[" +
                    "      {" +
                    "        \"visibility\":\"off\"" +
                    "      }" +
                    "    ]" +
                    "  }" +
                    "]");
            break;
        case R.string.style_label_default:
            // Removes previously set style, by setting it to null.
            style = null;
            break;
        default:
            return;
    }
    mMap.setMapStyle(style);

Xamarin Android中是否有这样的功能?

随着Xamarin google play map services v 32.961.0的发布,现在支持MapStyleOptions

要使用样式化贴图,请创建新的MapStyleOptions对象

private void setSelectedStyle()
    {
        MapStyleOptions style;
        style = new MapStyleOptions("[" +
                    "  {" +
                    "    \"elementType\":\"geometry\"," +
                    "    \"stylers\":[" +
                    "      {" +
                    "        \"color\":\"#242f3e\"" +
                    "      }" +
                    "    ]" +
                    "  }," +
                    "  {" +
                    "    \"featureType\":\"transit\"," +
                    "    \"elementType\":\"geometry\"," +
                    "    \"stylers\":[" +
                    "      {" +
                    "        \"color\":\"#2f3948\"" +
                    "      }" +
                    "    ]" +
                    "  }" +
                    "]");
        map.SetMapStyle(style);
    }

随着Xamarin google play map services v 32.961.0的发布,MapStyleOptions现在得到了支持

要使用样式化贴图,请创建新的MapStyleOptions对象

private void setSelectedStyle()
    {
        MapStyleOptions style;
        style = new MapStyleOptions("[" +
                    "  {" +
                    "    \"elementType\":\"geometry\"," +
                    "    \"stylers\":[" +
                    "      {" +
                    "        \"color\":\"#242f3e\"" +
                    "      }" +
                    "    ]" +
                    "  }," +
                    "  {" +
                    "    \"featureType\":\"transit\"," +
                    "    \"elementType\":\"geometry\"," +
                    "    \"stylers\":[" +
                    "      {" +
                    "        \"color\":\"#2f3948\"" +
                    "      }" +
                    "    ]" +
                    "  }" +
                    "]");
        map.SetMapStyle(style);
    }
然后在四月一日打电话过来