解析XML不匹配的标记时出错 [英] Error parsing XML mismatched tag

查看:168
本文介绍了解析XML不匹配的标记时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<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不匹配的错误出现并且我似乎找不到该错误为止. 当我添加imageview后,当我尝试构建时会出现以下错误: 在此行找到多个注释: -错误:解析XML错误:标记不匹配 -元素类型"LinearLayout"必须由匹配的结束标记"终止. 有人知道我的代码有什么问题吗? 谢谢

my code was fine and i tested out a few times and it work until the error parsing xml mismatched appear and i can't seem to find the error. After i add the imageview the following error appears when i try to build : Multiple annotations found at this line: - error: Error parsing XML: mismatched tag - The element type "LinearLayout" must be terminated by the matching end-tag "". Does someone know whats wrong with my code? thanks

推荐答案

错误消息非常准确:

在此行发现多个注释:-错误:解析XML时出错: 标签不匹配-元素类型"LinearLayout"必须终止 通过匹配的结束标签

Multiple annotations found at this line: - error: Error parsing XML: mismatched tag - The element type "LinearLayout" must be terminated by the matching end-tag

您的xml打开两个<LinearLayout>标记(第一行中的一个,一个作为<ScrollView>的第一个元素),但是仅关闭一个.

Your xml opens up two <LinearLayout> tags (one on the first line, one as the first element of the <ScrollView>) but it only closes one.

</ScrollView>之前添加</LinearLayout>应该可以解决此问题.

Adding a </LinearLayout> before </ScrollView> should resolve this.

这篇关于解析XML不匹配的标记时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆