【问题标题】:Error parsing XML: unbound prefix解析 XML 时出错:未绑定前缀
【发布时间】:2015-04-14 14:27:48
【问题描述】:
 <TableRow
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="3dp"
        android:background="#ffffff" >

        <com.facebook.widget.ProfilePictureView
            android:id="@+id/profilePicture"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dp"
            android:gravity="center_horizontal"
            facebook:preset_size="normal" />
    </TableRow>

我想在我的程序中包含个人资料图片,但是当我在上面的行中编码时,它显示错误消息:(Error parsing XML: unbound prefix)

我怎样才能摆脱这个错误。

【问题讨论】:

标签: android xml facebook android-layout


【解决方案1】:

如果您查看 xml 文件的最顶部,通常会有这样一行:

xmlns:android="http://schemas.android.com/apk/res/android"

这会执行一个名为 android 的 XML 命名空间,因此任何带有 android:* 的内容都会转到该文件以查找它。

您可能没有声明 facebook 的命名空间。所以在继续之前你需要这样做。

【讨论】:

    【解决方案2】:

    您需要在第一个父标签中添加此行:

    xmlns:facebook="http://schemas.android.com/apk/res-auto"
    

    【讨论】:

      猜你喜欢
      • 2015-01-27
      • 1970-01-01
      • 2023-03-25
      • 1970-01-01
      • 2015-05-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多