簡體   English   中英

android xml錯誤解析xml:格式不正確

[英]android xml error parsing xml:not well formed

我對XML還是很陌生,我只是針對android開發學習它。 但是IDE生成了一系列的TextViews和EditTexts,其中兩個給我一個“解析xml時出現xml錯誤:格式不正確”的錯誤(textView1和editText2),我問過我的同伴和講師,但沒有人真的很確定錯了。 感謝所有的幫助,並在此先感謝。

<?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:weightSum="100"
    android:orientation="vertical" >
    <ScrollView android:layout_weight="30" android:layout_width="fill_parent" android:layout_height="fill_parent">
    <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">

    <TextView android:id="@+id/textView1" android:layout_width="wrap_content"  android:layout_height="wrap_content" android:text="TextView" />

    <EditText android:id="@+id/editText1" android:layout_width="match_parent" android:layout_height="wrap_content" android:ems="10" >
    </EditText>

    <TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="TextView" />

    <EditText android:id="@+id/editText2"android:layout_width="match_parent"  android:layout_height="wrap_content"  android:ems="10" />

    <TextView android:id="@+id/textView3"android:layout_width="wrap_content"  android:layout_height="wrap_content"android:text="TextView" />

    <EditText android:id="@+id/editText3"android:layout_width="match_parent" android:layout_height="wrap_content"  android:ems="10" />

    <TextView android:id="@+id/textView4"android:layout_width="wrap_content" android:layout_height="wrap_content"  android:text="TextView" />

    <EditText android:id="@+id/editText4" android:layout_width="match_parent"android:layout_height="wrap_content"android:ems="10" />

    <TextView android:id="@+id/textView5"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="TextView" />

    <EditText android:id="@+id/editText5"android:layout_width="match_parent"android:layout_height="wrap_content"android:ems="10" />

    <TextView android:id="@+id/textView6"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="TextView" />

    <EditText android:id="@+id/editText6"android:layout_width="match_parent"android:layout_height="wrap_content"android:ems="10" />
    </LinearLayout>
    </ScrollView>
    <LinearLayout android:layout_width="match_parent"
    android:layout_height="fill_parent)"
    android:orientation="vertical"
    android:layout_weight="40">
    <Button android:id="@+id/button1"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="Button" />
    </LinearLayout>
    <LinearLayout android:layout_width="match_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:layout_weight="30">
    <AnalogClock android:id="@+id/analogClock1" android:layout_width="wrap_content"android:layout_height="wrap_content" />
    </LinearLayout>
</LinearLayout>

您的錯誤是此行:

        android:layout_height="fill_parent)"

在您的第一個內部LinearLayout中。 當然,您應該刪除')'。

由於某些原因,編輯器無法為您提供正確的錯誤行。 使用Eclipse時,應使用Ctrl(/ apple)+ shift + F。 它將自動格式化您的文件。 完成此操作后,很容易發現該錯誤。

PS。 使用match_parent而不是fill_parent,不建議使用fill_parent。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM