【问题标题】:Android Error parsing XML: not well-formedAndroid 解析 XML 时出错:格式不正确
【发布时间】:2012-12-06 22:26:09
【问题描述】:

我有一个错误:在我的 activity_main.xml 文件中解析 XML:not well-formed(invaled token) 时出错,我终其一生都无法弄清楚它是什么。我尝试重新输入它以确保它与引号无关。我几乎从一本书中复制代码。 代码是:

<?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" 

<com.google.android.maps.MapView
    android:id="@+id/mapView"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:enabled="true"
    android:clickable="true"
    android:apiKey="0ak81Gwf6w8ZZhWxdNiCS8e6LvqrrwZ8nUZKmbQ" />
</LinearLayout>

【问题讨论】:

    标签: android xml parsing xml-parsing


    【解决方案1】:

    改成这样:

    <LinearLayout 
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >
    
    <com.google.android.maps.MapView
        android:id="@+id/mapView"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:enabled="true"
        android:clickable="true"
        android:apiKey="0ak81Gwf6w8ZZhWxdNiCS8e6LvqrrwZ8nUZKmbQ" />
    </LinearLayout>
    

    您没有关闭 LinearLayout 起始标签。

    【讨论】:

    • 保存并清理项目
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多