I am trying to show several polygons on my MapView, some of them overlap and have different colors. When I add them, everything looks good, but as soon as I zoom out, many (not all) of the polygons stop filling. Scaling back and forth and scrolling sometimes fill some of them again, but this seems to be random behavior.
Code for adding polygons:
clearAreas(); for (Area area: areas) { for (List<LatLng> subArea: area.getSubAreas()) { mAreaPolygons.add(getMap().addPolygon( new PolygonOptions() .strokeWidth(2.0f) .zIndex(++zIndex) .strokeColor(area.getColor()) .fillColor(area.getTransparentColor()) .addAll(subArea))); } }
I understand that (according to the documentation) Polygon will not fill up if its geometry is not specified correctly. I tried to add points both clockwise and counterclockwise, it does not matter.
Can anyone explain this behavior?
Update . If the debugger is connected, everything works fine! Polygons are filled and remain filled when scaling. As soon as I disconnect the debugger, the polygons again begin to lose their filling. What's going on here?
Update # 2 . The problem appears in my Galaxy S3. Surprisingly, it works on a slower, older device! Since attaching a debugger makes the application rather slow, is there maybe some kind of connection here?
Thanks a lot Marco
android polygon google-maps
Marco lamina
source share