Android XML Error parsing XML: junk after document element

前端 未结 2 1698
盖世英雄少女心
盖世英雄少女心 2020-12-06 05:49

I am getting this error:

Multiple annotations found at this line: - The markup in the document following the root element must be well- formed. - error

相关标签:
2条回答
  • 2020-12-06 06:40

    An XML document can only have 1 root element. You have 3 such elements. You should enclose your TextView elements inside a layout, such as a LinearLayout:

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                  android:orientation="vertical"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent">
    
        <!-- TextView elements here -->
    
    </LinearLayout>
    

    Remove the xmlns attribute on the first TextView element.

    0 讨论(0)
  • 2020-12-06 06:44

    you should encapsule your elements in layouts, such as LinearLayout. You can look at a layout config file in existence.

    0 讨论(0)
提交回复
热议问题