試試這個:
PolylineOptions polyline_options = new PolylineOptions()
.addAll(arraylist_lat_lon).color(Color.GREEN).width(2);
polyline = googleMap.addPolyline(polyline_options);
在此之前, 添加色彩XML你值文件夾,並定義你想要的所有顏色。 就像這樣: -
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="blue">#82CAFF</color>
<color name="red">#FF0000</color>
<color name="white">#FFFFFF</color>
<color name="black">#000000</color>
<color name="symptom_color_selected">#003366</color>
<color name="reaction_color_selected">#003366</color>
<color name="static_text_color">#003366</color>
<color name="journal_entry_listitem_text_color">#003366</color>
<color name="note_text_disabled">#333333</color>
<color name="blue">#0000FF</color>
<color name="navy">#6699FF</color>
<color name="sky">#0099CC</color>
<color name="gray">#808080</color>
<color name="lightgray">#e7e7e7</color>
<color name="lightgray02">#bfbfbf</color>
<color name="dark">#000015</color>
<color name="lightgreen">#336666</color>
<color name="orrange">#e33d1b</color>
<color name="darkorrange">#cc2303</color>
<color name="pressed_color">#FF8E4067</color>
<color name="focussed_color">#DD8E4067</color>
</resources>
我用它,但仍**。Color **返回一個錯誤「不可使用的成員Android.Gms.Maps.Model.PolylineOptions.Color不能像方法一樣使用」 – fulgen
你能顯示你的更新代碼嗎? –
折線線= map.addPolyline(新的PolylineOptions() 。新增(新經緯度(-37.81319,144.96298),新的經緯度(-31.95285,115.85734)) .WIDTH(25) 。顏色(Resources.GetColorStateList(資源。 Color.blue)) .geodesic(true)); – fulgen