2016-05-10 3 views
0

In meinem Projekt verwende ich KML-Datei aus Raw-Ordner in MapView API V2 zu rendern. Es wird jedoch nicht das [CDATA] -Tag mit dem Wert der angegebenen Variablen gerendert, sondern es wird die Variable selbst angezeigt. Folgende ist meine KML-Datei:Rendern CDATA HTML-Tag aus KML-Datei in Android-Karte api v2 funktioniert nicht

<?xml version="1.0" encoding="UTF-8"?> 
<kml xmlns="http://www.opengis.net/kml/2.2"> 
<Document> 
    <name>Data+BalloonStyle</name> 
    <Style id="golf-balloon-style"> 
    <IconStyle> 
      <color>ff3644DB</color> 
      <scale>1.1</scale> 
      <Icon> 
       <href>http://www.gstatic.com/mapspro/images/stock/503-wht-blank_maps.png</href> 
      </Icon> 
      <hotSpot x='16' y='31' xunits='pixels' yunits='insetPixels'> 
      </hotSpot> 
     </IconStyle> 
    <BalloonStyle> 
     <bgColor>ffffffbb</bgColor> 
      <text><![CDATA[ 
      <b><font color="#CC0000" size="+3">$[name]</font></b> 
      <br/><br/> 
      <font face="Courier">$[description]</font> 
      <br/><br/> 
      Extra text that will appear in the description balloon 
      <br/><br/>$[geDirections] 
      ]]></text> 

    </BalloonStyle> 
    </Style> 
    <Placemark> 
    <name>Club house</name> 
    <description>An example of BalloonStyle</description> 
    <styleUrl>#golf-balloon-style</styleUrl> 
    <ExtendedData> 
     <Data name="geDirections"> 
     <value>1</value> 
     </Data> 
     <Data name="holeYardage"> 
     <value>234</value> 
     </Data> 
     <Data name="holePar"> 
     <value>4</value> 
     </Data> 
    </ExtendedData> 
    <Point> 
     <coordinates>103.80148899999995,1.440409,0.0</coordinates> 
    </Point> 
    </Placemark> 
    <Placemark> 
    <name>By the lake</name> 
    <description>An example of BalloonStyle</description> 
    <styleUrl>#golf-balloon-style</styleUrl> 
    <ExtendedData> 
     <Data name="geDirections"> 
     <value>5</value> 
     </Data> 
     <Data name="holeYardage"> 
     <value>523</value> 
     </Data> 
     <Data name="holePar"> 
     <value>5</value> 
     </Data> 
    </ExtendedData> 
    <Point> 
      <coordinates>103.90148899999995,1.440409,0.0</coordinates> 
    </Point> 
    </Placemark> 
</Document> 
</kml> 

Es Infofenster mit Variablenname $ anzuzeigen [name], $ [description] und [geDirections] itself.Following ist die Ausgabe: enter image description here

Bitte geben Sie einige Informationen in Bezug auf dieses Problem. Danke!

+0

Überprüfen Sie diese https://developers.google.com/kml/documentation/kml_tut#using-the-cdata-element –

+0

Ich ging durch diese. Nichts davon funktioniert. Möglicherweise ist es ein Problem in Android, das einen Variablenwert von KML nicht rendert. Ich habe fast alles ausprobiert – AndiM

Antwort