"Mulitble root tags Error" - was sagt diese Fehlermeldung aus?

Guten Tag,

Ich arbeite momentan mithilfe eines Java-Einsteiger-Buches an einer Quiz-App.

In meiner activity_main.cml Datei habe ich jetzt die ersten Zeilen geschrieben und bin bereits an einen Fehler gestoßen. Meine Entwicklungsumgebung(Android Studio 1.3) markiert eine geöffnete Klammer "rot" und gibt mir die Fehlermeldung: " Multible root tags Error" .

Hier der Quelltext:
Java:
<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" android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">

    <TextView android:text="@string/hello_world" android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

</RelativeLayout>

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmls:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:gravity="center_horizontal"
    android_padding="10dp">
<TextView
    android:id="@+id/frage"
    android:layout_width="wrap_content"
    android:layout_height="40sp"
    android:layout_marginBottom="5dp"
    android:text="@string/app_name"
    android:textStyle="bold"></TextView>

<TableLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">
    <TableRow
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <Button
            android:id="@id/antwort1"
            android:layout_width="150dp"
            android:layout_height="wrap_content"
            android:text="Button"></Button>
        <Button
            android:id="@id/antwort2"
            android:layout_width="150dp"
            android:layout_height="wrap_content"
            android:text="Button"></Button>
        </TableRow>
        <TableRow
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            <Button
                android:id="@id/antwort3"
                android:layout_width="150dp"
                android:layout_height="wrap_content"
                android:text="Button"></Button>
            <Button
                android:id="@id/antwort4"
                android:layout_width="150dp"
                android:layout_height="wrap_content"
                android:text="Button"></Button>
            </TableRow>
        </TableLayout>

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            <ProgressBar
                android:id="@id/progressBar1"
                android:layout_width="match_parent"
                android:layout_height="60dp"
                style="@android:style/Widget.ProgressBar.Horizontal"
                android:max="8"
                android:progress="0"></ProgressBar>
            <TextView
                android:id="@+id/textView2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Erreichter Spielstand"
                android:layout_gravity="center"
                android:textColor="#555555"></TextView>
            </FrameLayout>
</LinearLayout>


Die Klammer vor "LinearLayout" wird markiert. Woran könnte das liegen? Und was bedeutet diese fehlermeldung?

Für Hilfe wäre ich dankbar, da ich sonst nirgents etwas darüber lese. :/

Lg
Siegfried
 

Dompteur

Top Contributor
Code:
<?xml version="1.0" encoding="utf-8"?>
In einem XML muss diese Anweisung ganz am Anfang stehen.

Dann mußt du wissen, dass ein XML relativ strengen Syntax-Regeln entsprechen muss. Eine davon ist, dass es ein alles umschließende Tag gibt. Du darfst also nicht 2 Tags auf der "obersten" Ebene haben.
Details zum Aufbau müsstest du im entsprechenden XSD finden.
 

Neue Themen


Oben