Ich möchte Google-Anzeigen in meiner App anzeigen, aber es zeigt Fehler unexpected namespace prefix xmlns
an diesem Tag xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
. Wenn ich diese Zeile entferne, wird Error parsing XML:unbound prefix
angezeigt. Bitte helfen Sie mir, das zu erkennen, wo etwas schief läuft. Hier ist mein Code.Warum Fehler unerwarteten Namespace-Präfix Xmlns in Android zeigen?
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/background_port"
tools:context=".MainActivity">
<LinearLayout xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
>
<com.google.ads.AdView android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="a151b801b7c1d6b"
ads:adSize="BANNER"
ads:testDevices="TEST_EMULATOR, TEST_DEVICE_ID"
ads:loadAdOnCreate="true"/>
</LinearLayout>
--------------------
---- More views ----
--------------------
</LinearLayout>
Manchmal ist die Flusen in AS tatsächlich richtig. Mein Problem war, dass ich versuchte, https://github.com/TonicArtos/SuperSLiM zu verwenden, und es stellte sich heraus, dass die Tags, die die Bibliothek verwendet, nur in der Stammansicht der XML-Datei platziert werden dürfen, nicht in den untergeordneten Ansichten. Ich muss nicht erwähnen, dass die Bibliothek nicht richtig funktionierte, wenn ich den Flusen ignorierte. – vanomart