解析XML时出错:未绑定前缀 - 元素类型"LinearLayout"必须后跟任一属性规范

chr*_*iss 0 java xml android

我是java和android的新手.我的main.xml文件需要一些帮助.
这是我的错误 - 错误:解析XML时出错:未绑定前缀 - 元素类型"LinearLayout"必须后跟属性规范,">"或"/>".- 错误:解析XML时出错:这里格式不正确(无效令牌)
是我的main.xml文件

<?xml version="1.0" encoding="utf-8"?
LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  
    android:orientation="vertical"  
    android:layout_width="fill_parent"  
    android:layout_height="fill_parent"  
EditText  
    android:id="@+id/myEditText"   
    android:layout_width="fill_parent"   
    android:layout_height="wrap_content"  
    andtoid:text="New To Do Item"  
    EditText>  
ListView  
    android:id="@+id/myListView"  
    android:layout_width="fill_parent"  
    andtoid:layout_height="wrap_content"  
    />  
</LinearLayout>  
Run Code Online (Sandbox Code Playgroud)

错误与编辑文本有关.谢谢你能给予
cs的所有帮助

Dal*_*mas 6

您的XML中存在很多错误,这是一个合适的错误:

<?xml version="1.0" encoding="utf-8" ?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"  
    android:layout_width="fill_parent"  
    android:layout_height="fill_parent" >
    <EditText  
        android:id="@+id/myEditText"   
        android:layout_width="fill_parent"   
        android:layout_height="wrap_content"  
        android:text="New To Do Item" />
    <ListView  
        android:id="@+id/myListView"  
        android:layout_width="fill_parent"  
        android:layout_height="wrap_content" />  
</LinearLayout>  
Run Code Online (Sandbox Code Playgroud)

有时你使用"andtoid"而不是"android".

我认为你也会得到一个错误(稍后),因为你的ListView应该使用android:id="@id/android:list".

  • 看看我的代码和你的代码之间的差异. (2认同)