我是java編程新手,現在嚴格遵循一個教程。直到發生了一些我無法修復的事情時,我已經深入瞭解它。我搜索谷歌,一遍又一遍地查看代碼,並沒有看到任何錯誤。這裏是我的代碼截圖.... nvm我不允許發佈圖片,因爲我是新手,所以這裏是代碼複製。第一個X表示錯誤解析XML:沒有正確形成(無效標記),第二個X表示XML文檔結構必須在同一實體內開始和結束。我感謝所有的幫助,謝謝。解析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
完成XML代碼。其不完整 – Akilan