-1

嗨,我刚开始编程,我刚刚收到此错误消息“在此行找到多个注释:- 根元素后面的文档中的标记必须格式正确。”

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" 
    android:background="@drawable/jcea"
    />
</LinearLayout>
4

2 回答 2

0

您将两次关闭 LinearLayout 元素。删除一个结束标签,例如:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" 
    android:background="@drawable/jcea"
    />
于 2013-09-01T19:03:47.250 回答
0

将 替换为/>>或删除/

在 xml 中,/>如果标签没有任何关联的数据,则是另一种关闭标签的方式。例如,以下两个语句都是有效且相同的:

<tag></tag>

<tag/>

话虽如此,您应该将代码片段更改为:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" 
    android:background="@drawable/jcea">
</LinearLayout>

或者

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" 
    android:background="@drawable/jcea"/>
于 2013-09-01T19:06:17.170 回答