2016-03-19 10 views
1

Arbeits ich versuche, ein Polygon erstellen einen Bereich mit diesem Code zu decken:fillColor in Google Maps API Polygon nicht

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) 
    ); 

Aber fillColor nicht funktioniert (siehe Screenshot)

enter image description here

Also, gibt es eine Lösung dafür ...? Vielen Dank.

+0

Was genau ist das Problem, vor dem Sie stehen? –

+0

Siehst du die graue Linie ..? Ich versuche, ein Polygon zu erstellen, um einen Bereich abzudecken .., dann versuche ich es mit Farbe zu füllen .., und ich folge einfach den Dokumenten in developers.google.com .., aber es funktioniert nicht .., –

+0

ok ich sehe es. Ich werde Ihnen eine Lösung geben, nachdem Sie Ihren Code getestet haben. –

Antwort

2

Sie Problem in Reihenfolge der Zugabe des latlng in die Liste haben. Bitte tun Sie es in einer Reihenfolge der 47 Nummer latlng ist das erste Problem. Bitte sehen Sie es sich an.

Die in die Liste zum Zeichnen eines Polygons hinzugefügte Länge muss in einer Reihenfolge sein (entweder im oder gegen den Uhrzeigersinn). also solltest du diese Befehle befolgen.

lassen Sie mich wissen, wenn dies Ihr Problem löst.

+0

was latlng ist es ...? -7.841640, 110.058768 oder -8.191126, 110.797598? –

+0

Ja, es gibt mehr als 10 latlng .., ich benutze dieses Tool zu machen: http://www.hamstermap.com/quickmap.php [Tool] http://prnt.sc/ahanki [Ergebnis] http://prnt.sc/ahapc3 Jetzt kann ich meine Arbeit fortsetzen .., danke .., –

+1

hast du dein Problem gelöst @MuhammadIrfanLuthfi –

1

Versuchen Sie, wie dieses

// 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); 
+0

Nun, ich muss den Bereich innerhalb der grauen Linie mit Farbe füllen ..., nicht einen Kreis oder etwas .., aber danke .., –