android - com.facebook.widget.ProfilePictureView - 错误 : Error parsing XML: unbound prefix

标签 android xml facebook

是的,我在

<com.facebook.widget.ProfilePictureView 

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

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

也没有结果

enter image description here

最佳答案

您的 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"

关于android - com.facebook.widget.ProfilePictureView - 错误 : Error parsing XML: unbound prefix,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20593245/

相关文章:

iOS FBSDK v4 loginbuttondidlogout 无法识别的选择器

java - android 图像方向根据相机 Intent 而变化(或从图库中选择)

android - 关于从 crashlytics 的邀请邮件安装 apk 的问题

android ScrollView 最小化我的项目高度

php - 警告:DOMDocument::loadXML():需要开始标记,在实体中找不到 '&lt;'

javascript - Addmefast.com 检查在新窗口中单击的“赞”按钮?如何

android - 使用http post params android的基本身份验证

android - 想要在 Android 应用程序中的两个事件之间设置时间间隔

java - 在 Android Manifest.xml 中接收短信

facebook - FB 在新窗口分享