zoukankan      html  css  js  c++  java
  • Error parsing XML: junk after document element java程序员

    今天开始接触android的Java编程,出现问题了。

    我的代码是这样的:

    <LinearLayout 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:orientation="horizontal"
        tools:context=".MainActivity" >

    </LinearLayout>

    <EditText android:id="@+id/edit_message"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:hint="@string/edit_message"/>
    <Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/button_send" />

    应该把</LinearLayout>放在最后一行。

    原因:

    这里Android123提示大家一般合法的XML文件只有一个主根节点,比如

    <android123>
        <item1/>
        <item2/>
        <item3/>
    </android123>

    如果出现了Error parsing XML: junk after document element这样的错误,你的想法可能只要主根有多个节点,比如说

     <android123>
        <item1/>
    </android123>
    <android123>
        <item2/>
        <item3/>
    </android123>


  • 相关阅读:
    python中的编码问题
    CVPR2018 Tutorial 之 Visual Recognition and Beyond
    hdu 1376 Octal Fractions
    hdu 1329 Hanoi Tower Troubles Again!
    hdu 1309 Loansome Car Buyer
    hdu 1333 Smith Numbers
    hdu 1288 Hat's Tea
    hdu 1284 钱币兑换问题
    hdu 1275 两车追及或相遇问题
    hdu 1270 小希的数表
  • 原文地址:https://www.cnblogs.com/java20130725/p/3215471.html
Copyright © 2011-2022 走看看