更改折线的颜色android的谷歌地图V2 [英] Change the color of polyline in android google map v2
本文介绍了更改折线的颜色android的谷歌地图V2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我从这个链接的https://developers.google.com/maps/documentation/android/shapes#customizing_appearances
Polyline line = map.addPolyline(new PolylineOptions()
.add(new LatLng(-37.81319, 144.96298), new LatLng(-31.95285, 115.85734))
.width(25)
.color(Color.BLUE)
.geodesic(true));
我的问题是的颜色在 Color.Blue 返回一个错误,说颜色不当前上下文中的名称。
My Problem is Color in Color.Blue returns an error saying The name Color does not exist in the current context.
推荐答案
我已经解决了我的问题。
I already solved my problem.
首先,我创造了我的价值观xml文件夹Color.xml
First I created an xml file in my values folder Color.xml
Color.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="blue">#0000EE</color>
</resources>
然后在我的活动
Polyline line = map.addPolyline(new PolylineOptions()
.Add(new LatLng(-37.81319, 144.96298), new LatLng(-31.95285, 115.85734))
.InvokeColor(Resources.GetColor(Resource.Color.blue));
这篇关于更改折线的颜色android的谷歌地图V2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文