android - Facebook 登录按钮小部件没有资源标识符

标签 android facebook android-resources

我继承了一些代码并正在处理它,但是,当我尝试构建它时,我遇到了以下问题:

activity_login.xml:26: error: No resource identifier found for attribute 'login_text' in package

我的按钮xml如下:

<com.facebook.widget.LoginButton
        xmlns:fb="http://schemas.android.com/apk/res-auto"
        android:id="@+id/facebookBtn"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="25dp"
        android:textColor="@color/white"
        android:textAppearance="@android:style/TextAppearance.Small"
        android:gravity="center"
        android:onClick="facebookBtnClick"
        android:paddingLeft="30dp"
        fb:login_text="@string/loginWithFacebook"
        />

我也试过放入 xmlns:fb="http://schemas.android.com/apk/res/com.facebook.widget" 但这对我也不起作用,如果有人有任何建议,我将不胜感激

最佳答案

您可以在这里找到信息 https://developers.facebook.com/docs/android/upgrading-4.x

Style attr tags are now namespaced to avoid conflicts. Apps will need to add the namespace "com_facebook_" to their existing facebook sdk style attrs.

所以,现在使用 fb:com_facebook_login_text

关于android - Facebook 登录按钮小部件没有资源标识符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27062334/

相关文章:

Android 在 QuickOffice 崩溃中通过 ContentResolver 打开 .docx 文件

java - 如何将包含 parcelable 类 'A' 实例的 Parcelable 类 'B' 的实例写入 'B' 类的 Parcel

Facebook FQL。无法从 event_member 获取 eid 列表

facebook - 如何清除调试工具缓存数据?

android - 如何使用 mockk 库模拟 android 上下文

java - 如何在我的应用中添加 Material Design

使用 TestCoroutineDispatcher(已弃用)替代方案对 Kotlin 协程进行 Android 测试

javascript - 如何实现 Facebook 转化跟踪 onclick 或当没有单独的 'Thank you' 页面时

来自数据库的 Android 字符串资源

java - 我不能在 Android 中使用 getResource().getString