我是 Java 编程的新手,现在正在严格遵循一个教程。我深入研究了它,直到发生了我无法解决的事情。我搜索了谷歌并一遍又一遍地查看代码,并没有发现任何错误。这是我的代码的屏幕截图....nvm 我不允许发布图片,因为我是新手,所以这里是复制的代码。第一个 X 表示解析 XML 时出错:格式不正确(无效标记),第二个 X 表示 XML 文档结构必须在同一实体内开始和结束。我感谢所有的帮助,谢谢。
< ?xml version="1.0" encoding="utf-8"?>
< LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/myMessage"
android:text="@string/hello" />
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/myButton"
android:text="@string/answer"
/>
< LinearLayout--------1st X is located here. The < is not spaced in the code but spaced here because that was the only way i could put it here
android:layout_width="fill_parent"
android:layout_height="20dp"
android:orientation="horizontal">
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:gravity="center"
android:background="#ff0000"
android:textColor="#000000"
android:text="red" />
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:gravity="center"
android:background="#00ff00"
android:textColor="#000000"
android:text="green" />
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:gravity="center"
android:background="#0000ff"
android:textColor="#000000"
android:text="blue" />
< LinearLayout >---------2nd X is located here. The < is not spaced in the code but spaced here because that was the only way i could put it here and there is a / in between < and LinearLayout