private void drawPolygon(List<LocationPointsModel> locationPoints, String fencingColor) {
mMap.clear();
PolygonOptions rectOptions = new PolygonOptions();
rectOptions.strokeColor(Color.parseColor(fencingColor));
rectOptions.strokeWidth(2);
String fillcolor = Constants.FILL_COLOR_GEOFENCE + fencingColor.substring(1);//creating opacity less color
rectOptions.fillColor(Color.parseColor(fillcolor));
LatLngBounds.Builder builder = new LatLngBounds.Builder();
int size = locationPoints.size();
for (int i = 0; i < size; i++) {
LatLng latLng = new LatLng(locationPoints.get(i).getLat(), locationPoints.get(i).getLon());
latList.add(latLng);
rectOptions.add(latLng);
}
Polygon polygon = mMap.addPolygon(rectOptions);
}
In some cases if the polygon lines intersect fill color is not properly rendered.Polygon Fill color Issue. Is that possible to fill polygon with following way. Desired output.