6
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:id="@+id/tab1"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <ScrollView
            android:id="@+id/scrollView1"
            android:layout_width="wrap_content"
            android:layout_height="match_parent">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/textView1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:gravity="center"
                    android:text="About the course"
                    android:textColor="#0000ff"
                    android:textSize="20dp" />

                <TextView
                    android:id="@+id/textView2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10dp"
                    android:text="This course equips you the skills to handle and manage the technology that is so vital in the field of media and communication, namely digital communication, wireless devices, broadband, media design and other emerging media and telecommunication technologies."
                    android:textColor="#0000ff"
                    android:textSize="14dp" />
                <ImageView
                    android:id="@+id/imageView1"
                    android:layout_width="214dp"
                    android:layout_height="171dp"
                    android:layout_marginTop="10dp"
                    android:adjustViewBounds="true"
                    android:padding="10dp"
                    android:scaleType="fitStart"
                    android:src="@drawable/cinema4d"
                    android:layout_gravity="center" />
                <TextView
                    android:id="@+id/textView3"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10dp"
                    android:textColor="#0000ff"
                    android:text="What you learn:"
                    android:textSize="14dp" />
                <TextView
                    android:id="@+id/textView4"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10dp"
                    android:textColor="#0000ff"
                    android:textSize="14dp" 
                    android:text="Enrol in subjects on the fundamentals of media and communication technology and refine your specialisation by choosing elective subjects in areas such as multimedia networking and applications, wireless and mobile communications, and digital broadcasting with emphasis on a 'hands-on. minds-on' approach."/>
                <ImageView
                    android:id="@+id/imageView1"
                    android:layout_width="214dp"
                    android:layout_height="171dp"
                    android:layout_marginTop="10dp"
                    android:adjustViewBounds="true"
                    android:padding="10dp"
                    android:scaleType="fitStart"
                    android:src="@drawable/fdmp"
                    android:layout_gravity="center" />                
        </ScrollView>
    </LinearLayout>    
</LinearLayout>

私のコードは問題なく、数回テストしましたが、xml の解析エラーが表示されるまで機能し、エラーが見つからないようです。イメージビューを追加した後、ビルドしようとすると次のエラーが表示されます: この行に複数の注釈が見つかりました: - エラー: XML の解析中にエラーが発生しました: タグが一致しません - 要素タイプ "LinearLayout" は、一致する終了タグ "" で終了する必要があります。誰かが私のコードの何が問題なのか知っていますか? ありがとう

4

2 に答える 2

9

エラーメッセージは非常に正確です:

この行に複数の注釈が見つかりました: - エラー: XML の解析中にエラーが発生しました: タグが一致しません -要素タイプ「LinearLayout」は、一致する終了タグで終了する必要があります

xml は 2 つの<LinearLayout>タグ (最初の行に 1 つ、の最初の要素として 1 つ) を開きますが、1 つ<ScrollView>だけを閉じます。

</LinearLayout>beforeを追加すると、</ScrollView>これが解決するはずです。

于 2012-08-20T18:49:13.710 に答える
3

</LinearLayout>前にタグが必要です</ScrollView>

于 2012-08-20T19:21:32.573 に答える