Android 另一个r无法解析为变量/解析文档元素后的xml垃圾时出错

Android 另一个r无法解析为变量/解析文档元素后的xml垃圾时出错,android,xml,eclipse,defined,Android,Xml,Eclipse,Defined,我知道这是问了很多,但我得到了错误解析xml垃圾后,文档元素的问题,然后在寻找问题,我得到了10 r不能被定义的错误,我认为这一切都是由于第一个错误。但是,即使我删除了有问题的段落并单击“清除”,错误红色x仍然存在于空白区域中。错误开始于底部的textview行 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/an

我知道这是问了很多,但我得到了错误解析xml垃圾后,文档元素的问题,然后在寻找问题,我得到了10 r不能被定义的错误,我认为这一切都是由于第一个错误。但是,即使我删除了有问题的段落并单击“清除”,错误红色x仍然存在于空白区域中。错误开始于底部的textview行

    <?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:padding="25dp" >

<EditText
    android:id="@+id/etCommands"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:hint="Type a Command"
    android:password="true" />

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:weightSum="100" >

<Button
    android:id="@+id/bResults"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_weight="20"
    android:text="Try Command" />

<ToggleButton
    android:id="@+id/tbPassword"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_weight="80"
    android:checked="true"
    android:paddingBottom="10dp"
    android:text="ToggleButton" />
</LinearLayout>


<TextView
 android:text="invalid"
 android:id="@+id/tvResults"
 android:gravity="center"
 android:layout_width="fill_parent"
 android:layout_height="wrap_content"  />   
</LinearLayout>
应该是

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="100" >

请注意标记末尾的“否”。结尾的/是xml,请立即关闭此标记。目前,对于LinearLayout,有两个打开标记的无效xml,但关闭了LinearLayout三次。

如果不提供完整的xml文件,很难知道问题出在哪里。您可能忘记关闭一个LinearLayout项目

编辑:

只需从LinearLayout声明中删除/字符:

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="100" >

@用户1854482问题仍然与digitaljoel所说的差不多。你关闭了一个从未打开的线性布局。在第一个线性布局中有第二个开口。我想我对此比较陌生。是的,你有两个开口标记,但有三个开口标记。打开第一个,打开和关闭第二个。关闭第一个。最后一个关闭了您从未打开过的问题,并使您的xml格式不正确。我更改了它并清除了它,但textview开始标记旁边的xml错误仍然存在。请在执行并在eclipse中更新/clean/build之后,用您的新xml和特定的错误消息更新问题。我更改了它并清除了它,但错误标记仍在旁边文本视图开始标记仍然存在,我认为java中的所有r错误都是由xml错误引起的。将鼠标放在错误标记上,查看错误是什么。当res文件夹中没有错误时,代码中的R错误将消失,并且将生成一个R文件。错误解析xml:document元素和我更新了代码后的垃圾谢谢您在重新启动eclipse后的帮助错误消失了。
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="100" >