2013-05-09 2 views
7

Warum Unexpected Namespacepräfix "xmlns" für Tagfragment gefunden Unerwartetes Namespacepräfix "map" für Tagfragment gefunden?Unerwartetes Namespacepräfix "xmlns" für Tagfragment gefunden Unexpected Namespacepräfix "map" für Tagfragment gefunden

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context=".Main"> 

    <fragment xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:map="http://schemas.android.com/apk/res-auto" 
     android:id="@+id/map" 
     android:name="com.google.android.gms.maps.MapFragment" 

     map:mapType="satellite"/> 
</RelativeLayout> 

warum Unexpected Namespacepräfix "xmlns" für Tag Fragment Unexpected Namespacepräfix "Karte" für Tag Fragment gefunden?

Antwort

18

Entfernen Sie xmlns:android="http://schemas.android.com/apk/res/android" aus dem Element <fragment> und ziehen Sie in Betracht, das Element xmlns:map="http://schemas.android.com/apk/res-auto" vom Element <fragment> zum Stammelement zu verschieben.

Zum Beispiel das gilt:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:map="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/foo" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <fragment 
     android:id="@+id/map" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     class="com.google.android.gms.maps.SupportMapFragment" 
     map:mapType="satellite"/> 

</RelativeLayout> 
+0

dann –

+0

@ Mr.Strolling "für Tag Fragment gefunden "" Unexpected Namespacepräfix" Karte: – CommonsWare

+0

noch Unexpected Namespacepräfix aktualisiert Antwort siehe ** Karte ** für Tag Fragment –

0

versuchen diese

<fragment 
     android:id="@+id/map" 
     android:name="com.google.android.gms.maps.SupportMapFragment" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentRight="true" 
     android:layout_alignParentTop="true" 

2

Offensichtlich ist dies nur ein mis-lead Lint Prüffehler. Sie können es entfernen, wenn Sie in Eclipse Problemansicht mit der rechten Maustaste auf die Zeile mit dem Fehler klicken, die Option Quickfix auswählen und z. Ignorieren Überprüfen Sie, ob das Projekt vorliegt.

Der Fehler verschwindet, das Projekt wird erstellt und die App läuft einwandfrei.

+1

Durch das Bereinigen des Projekts wird dieser Fehler ebenfalls behoben – Price

Verwandte Themen