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

前端之家收集整理的这篇文章主要介绍了android – Facebook登录按钮小部件没有资源标识前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我继承了一些代码并且我正在研究它,但是,当我尝试构建它时,我得到以下问题:
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.

原文链接:https://www.f2er.com/android/317568.html

猜你在找的Android相关文章