我的代码有什么问题。它说错误:解析XML时出错:格式不正确(令牌无效)但一切看起来都不错

时间:2014-05-31 12:41:01

标签: android xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"

    <TextView
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       android:text="@string/name" 
       android:layout_marginTop="10dp"  
       android:layout_alignLeft="true" 
       android:id="@+id/insert_name" />


    <EditText 
       android:layout_below="@+id/insert_name"
       android:id="@+id/edit_message"
       android:layout_width="match_parent"
       android:layout_height="30dp"
       android:hint="@string/edit_message" 
       android:background="@drawable/border_edittext"
       android:tag="focusable" />




</RelativeLayout>

我的代码有什么问题。它说错误:解析XML时出错:格式不正确(令牌无效),但一切看起来都不错。

2 个答案:

答案 0 :(得分:3)

RelativeLayout上没有右括号。

答案 1 :(得分:0)

试试这个

 <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout 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"><!-- >missing -->

    <TextView
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       android:text="@string/name" 
       android:layout_marginTop="10dp"  
       android:layout_alignLeft="true" 
       android:id="@+id/insert_name" />


    <EditText 
       android:layout_below="@+id/insert_name"
       android:id="@+id/edit_message"
       android:layout_width="match_parent"
       android:layout_height="30dp"
       android:hint="@string/edit_message" 
       android:background="@drawable/border_edittext"
       android:tag="focusable" />
    </RelativeLayout>