我正在尝试使用 fresco 库。我以前也用过它并且它工作正常,但现在,由于某种原因我得到:
Unable to start activity ComponentInfo{com.example.home.template/com.example.home.template.MainActivity}: android.view.InflateException: Binary XML file line #26: Error inflating class com.facebook.drawee.view.SimpleDraweeView
我的 xml 文件:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:fresco="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/profileImage"
fresco:actualImageScaleType="centerCrop"
android:layout_width="200dp"
android:layout_gravity="center_horizontal"
android:layout_height="200dp" />
</LinearLayout>
我的申请:
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
FacebookSdk.sdkInitialize(this);
}
}
我的 list 中有它:android:name=".MyApplication"
我遇到的唯一问题是 draweeview。我可以做所有其他事情,例如登录和获取信息。
最佳答案
在我的案例中,在 setContentView(R.layout.myxml);
之前编写 Fresco.initialize(this);
帮助了我。
更新:
你有 FacebookSdk.sdkInitialize(this);
而不是 myapplication
中的 Fresco.initialize(this)
关于android - 错误膨胀类 com.facebook.drawee.view.SimpleDraweeView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36724100/