简体   繁体   English

Android Studio中的Facebook SDK按钮

[英]Facebook SDK button in android studio

I am trying to add a facebook login to my app, in addition to my custom log in. 除了我的自定义登录外,我还尝试将Facebook登录名添加到我的应用程序中。

I added facebook sdk as a module but when I try to add the Facebook Connect button I get an error. 我将facebook sdk添加为模块,但是当我尝试添加Facebook Connect按钮时出现错误。

Error:
 Rendering Problems The following classes could not be instantiated:
- com.facebook.widget.LoginButton (Open Class, Show Exception)
 Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE  Exception Details android.content.res.Resources$NotFoundException: Could not resolve resource value: 0x7F040001.

Code: 码:

<com.facebook.widget.LoginButton
android:id="@+id/authButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="45dp" />

First it is possible problem of the Eclipse, you just need to rester environment. 首先可能是Eclipse的问题,您只需要恢复环境即可。 To see if help. 看是否有帮助。

Secondary, try to use this code snippet to solve problem. 其次,尝试使用此代码段解决问题。

if (isInEditMode())
{
    //do something else, as getResources() is not valid.
} else {
    //you can use getResources()
    String mystring = getResources().getString(R.string.mystring);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM