gpt4 book ai didi

android - 在 android 中自定义 google maps V2 的配色方案

转载 作者:太空宇宙 更新时间:2023-11-03 11:50:47 25 4
gpt4 key购买 nike

目前我在我的 android 应用程序中使用 google maps v2,我遇到了 map 配色方案自定义的问题。我在这里看到它可以在 web 中使用 javascript https://developers.google.com/maps/customizehttp://jsfiddle.net/SQvej/js中的一些例子

var settingsItemsMap = {
zoom: 12,
center: new google.maps.LatLng(40.768516981, -73.96927308),
zoomControlOptions: {
style: google.maps.ZoomControlStyle.LARGE
},
styles:[
{ featureType: "water", stylers: [ { hue: "#F4B741"} ] },
{ featureType: "road", stylers: [ { hue: "#ff0000" } ] }
],
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById('map_canvas'), settingsItemsMap );

但没有找到安卓 map 的解决方案,有什么建议吗?

最佳答案

从这里创建样式

enter image description here

https://mapstyle.withgoogle.com/

然后将该 json 保存在 RAW 文件夹下,然后像这样在您的代码中调用该样式

MapStyleOptions style = MapStyleOptions.loadRawResourceStyle(getActivity(), R.raw.my_map_style);
googleMap.setMapStyle(style);

关于android - 在 android 中自定义 google maps V2 的配色方案,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16520121/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com