【问题标题】:com.facebook.widget.ProfilePictureView - error: Error parsing XML: unbound prefixcom.facebook.widget.ProfilePictureView - 错误:解析 XML 时出错:未绑定前缀
【发布时间】:2013-12-15 09:52:43
【问题描述】:

是的,我有这个错误

<com.facebook.widget.ProfilePictureView 

line 和 这是一个在 stackoverflow 上被问过很多次的问题,每次似乎都通过添加 xmlns:fb="http://schemas.android.com/apk/res -auto”在顶部。好吧,这并没有为我解决问题,不知道为什么:(那我该怎么办?

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:fb="http://schemas.android.com/apk/res-auto"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="20dp"
    android:gravity="center_horizontal"
    android:orientation="horizontal" >

    <com.facebook.widget.ProfilePictureView
        android:id="@+id/selection_profile_pic"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:gravity="center_horizontal"
        app:is_cropped="true"
        facebook:preset_size="small" />
</LinearLayout>

我也试过了

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

但效果不佳

这是我的 project.properties 文件:

target=android-18
android.library=false
android.library.reference.1=..\\actionbarsherlock
android.library.reference.2=..\\library
android.library.reference.3=../facebook-android-sdk-3.6.0/facebook

试着改成

target=android-18
android.library=false
android.library.reference.1=..\\actionbarsherlock
android.library.reference.2=..\\library
android.library.reference.3=..\\facebook-android-sdk-3.6.0\facebook

但也没有结果

【问题讨论】:

    标签: android xml facebook


    【解决方案1】:

    您的 XML 中有两个错误。

    1) 你没有声明命名空间“app”

    2) 您已声明命名空间 xmlns:fb="http://schemas.android.com/apk/res-auto" 但您将其称为“facebook”,即 facebook:预设尺寸

    你可以解决这个问题

    1) 为“app”添加命名空间声明,即 xmlns:app="http://schemas.android.com/apk/res-auto"

    2) 将您的“fb”命名空间声明重命名为“facebook”,即 xmlns:facebook="http://schemas.android.com/apk/res-auto"

    【讨论】:

    • 谢谢!!!我刚刚从 facebooks sdk 教程中复制了这个,所以我有点失望。我不得不承认我不知道什么是“应用程序”声明......我会尽快接受答案
    • 顺便说一句,为什么您认为我的 project.properties 文件在初始状态下在两个方向都有斜线?
    • 哦,我明白了。为了使用 app:is_cropped 属性,我需要告诉 XML 从哪里得到它的定义
    猜你喜欢
    • 1970-01-01
    • 2015-05-09
    • 2015-01-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-07
    • 2012-12-22
    • 1970-01-01
    相关资源
    最近更新 更多