Google maps 将样式化谷歌地图与Xamarin Android配合使用
有人知道如何在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
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);
}
然后在四月一日打电话过来