Android 代码没问题,但我得到了一个错误——XML文档结构必须在同一个实体中开始和结束
我将迈出android编程和XML的第一步。我用的是《大书呆子牧场指南》。在Eclipse中,我使用了书中给出的XML,我得到了一个错误:XML文档结构必须在同一个实体中开始和结束 我该如何解决这个问题Android 代码没问题,但我得到了一个错误——XML文档结构必须在同一个实体中开始和结束,android,xml,Android,Xml,我将迈出android编程和XML的第一步。我用的是《大书呆子牧场指南》。在Eclipse中,我使用了书中给出的XML,我得到了一个错误:XML文档结构必须在同一个实体中开始和结束 我该如何解决这个问题 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="24dp"
android:text="@string/question_text" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/true_button" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/false_button" />
</LinearLayout>
</LinearLayout>
问题已解决。我删除了代码并保存了xml文件。之后,我用上面的代码替换了它并保存了它。错误消失了。它可能是启用“自动构建项目”时的遗留问题
奇怪。你从哪里得到这个错误的?我把它放在Eclipse中,没有得到那个错误。@hichris123-谢谢。这可能是eclipse的一些问题。我回答了我自己的问题。