我尝试使用这些代码创建一个覆盖区域的多边形:
map.addPolygon(new PolygonOptions()
.add(new LatLng(-7.542257, 110.446209), new LatLng(-7.557232, 110.420116), new LatLng(-7.580375, 110.400890), new LatLng(-7.592626, 110.389904), new LatLng(-7.596710, 110.391277), new LatLng(-7.599433, 110.381664), new LatLng(-7.604877, 110.376171), new LatLng(-7.617128, 110.361065), new LatLng(-7.628017, 110.345959), new LatLng(-7.636184, 110.334972), new LatLng(-7.655239, 110.303387), new LatLng(-7.678377, 110.288280), new LatLng(-7.705595, 110.271801), new LatLng(-7.683820, 110.259441), new LatLng(-7.681098, 110.263561), new LatLng(-7.677696, 110.261938), new LatLng(-7.673119, 110.265402), new LatLng(-7.662818, 110.266557), new LatLng(-7.659385, 110.261938), new LatLng(-7.647940, 110.265402), new LatLng(-7.641073, 110.251545), new LatLng(-7.652518, 110.239997), new LatLng(-7.647940, 110.213436), new LatLng(-7.650229, 110.203043), new LatLng(-7.645651, 110.191495), new LatLng(-7.647940, 110.169554), new LatLng(-7.645651, 110.159161), new LatLng(-7.646795, 110.148768), new LatLng(-7.650229, 110.145881), new LatLng(-7.645079, 110.142416), new LatLng(-7.647940, 110.140107), new LatLng(-7.651373, 110.136642), new LatLng(-7.655379, 110.129714), new LatLng(-7.667396, 110.122208), new LatLng(-7.667969, 110.118166), new LatLng(-7.693718, 110.138375), new LatLng(-7.701729, 110.130868), new LatLng(-7.745785, 110.129714), new LatLng(-7.764665, 110.112969), new LatLng(-7.776679, 110.111814), new LatLng(-7.778395, 110.101421), new LatLng(-7.784688, 110.093338), new LatLng(-7.797274, 110.086409), new LatLng(-7.805283, 110.080057), new LatLng(-7.814435, 110.062158), new LatLng(-7.823273, 110.059111), new LatLng(-7.841640, 110.058768), new LatLng(-7.845381, 110.050528), new LatLng(-7.852183, 110.050528), new LatLng(-7.860345, 110.044005), new LatLng(-7.841299, 110.059111), new LatLng(-7.846061, 110.050185), new LatLng(-7.851503, 110.050528), new LatLng(-7.860345, 110.044348), new LatLng(-7.884832, 110.042288), new LatLng(-7.886192, 110.033705), new LatLng(-7.896734, 110.030272), new LatLng(-7.890953, 110.025465), new LatLng(-7.89213, 110.017569), new LatLng(-7.943321, 110.13635), new LatLng(-7.982762, 110.204337), new LatLng(-8.030019, 110.345099), new LatLng(-8.071491, 110.375311), new LatLng(-8.093246, 110.434019), new LatLng(-8.099704, 110.436766), new LatLng(-8.101403, 110.451529), new LatLng(-8.109561, 110.467322), new LatLng(-8.147627, 110.595381), new LatLng(-8.183990, 110.707991), new LatLng(-8.199282, 110.707304), new LatLng(-8.192825, 110.732367), new LatLng(-8.196903, 110.752623), new LatLng(-8.191126, 110.797598), new LatLng(-8.202340, 110.829871), new LatLng(-8.190446, 110.835020), new LatLng(-8.174135, 110.833990), new LatLng(-8.158162, 110.818541), new LatLng(-8.144228, 110.818198), new LatLng(-8.161561, 110.797942), new LatLng(-8.145248, 110.785239), new LatLng(-8.126215, 110.789702), new LatLng(-8.084408, 110.780089), new LatLng(-8.022880, 110.754683), new LatLng(-7.990582, 110.766013), new LatLng(-7.928019, 110.772536), new LatLng(-7.910677, 110.769446), new LatLng(-7.891633, 110.777342), new LatLng(-7.850482, 110.78955), new LatLng(-7.818171, 110.785582), new LatLng(-7.807967, 110.770132), new LatLng(-7.827014, 110.756743), new LatLng(-7.791300, 110.712454), new LatLng(-7.799463, 110.713484), new LatLng(-7.806266, 110.679839), new LatLng(-7.802185, 110.671255), new LatLng(-7.791300, 110.676405), new LatLng(-7.786198, 110.668166), new LatLng(-7.803885, 110.657523), new LatLng(-7.796062, 110.647223), new LatLng(-7.802865, 110.624907), new LatLng(-7.799804, 110.600188), new LatLng(-7.806266, 110.599501), new LatLng(-7.805926, 110.587485), new LatLng(-7.802525, 110.585768), new LatLng(-7.806607, 110.576498), new LatLng(-7.802185, 110.575812), new LatLng(-7.797082, 110.583022), new LatLng(-7.789939, 110.581992), new LatLng(-7.780415, 110.555556), new LatLng(-7.795722, 110.554869), new LatLng(-7.797082, 110.531180), new LatLng(-7.771911, 110.509894), new LatLng(-7.766468, 110.491698), new LatLng(-7.741294, 110.491354), new LatLng(-7.637920, 110.468298), new LatLng(-7.617709, 110.468298), new LatLng(-7.583539, 110.459558), new LatLng(-7.558511, 110.456645), new LatLng(-7.542257, 110.446209))
.strokeColor(Color.GRAY)
.strokeWidth(4)
.fillColor(Color.WHITE)
);
但fillColor
无效(请参见屏幕截图)
那么,有什么解决方案吗?非常感谢你。
答案 0 :(得分:2)
您在 将latlng 添加到列表中的顺序存在问题。请按顺序执行47号码latlng是初始问题。请看一下。
添加到列表中以绘制多边形的latlng将按顺序(顺时针或逆时针)。所以你应该遵循这些命令。
如果这可以解决您的问题,请告诉我。
答案 1 :(得分:1)
试试这个
// Instantiating CircleOptions to draw a circle around the marker
CircleOptions circleOptions = new CircleOptions();
// Specifying the center of the circle
circleOptions.center(point);
// Radius of the circle
ircleOptions.radius(50);
// Border color of the circle
circleOptions.strokeColor(Color.BLACK);
// Fill color of the circle
// 0x represents, this is an hexadecimal code
// 55 represents percentage of transparency. For 100% transparency, specify 00.
// For 0% transparency ( ie, opaque ) , specify ff
// The remaining 6 characters(00ff00) specify the fill color
circleOptions.fillColor(0x5500ff00);
// Border width of the circle
circleOptions.strokeWidth(2);
// Adding the circle to the GoogleMap
googleMap.addCircle(circleOptions);