android - 适用于 Android 的 Facebook LoginButton 不采用从 XML 传递的 login_text 和 logout_text 值

标签 android android-layout facebook-android-sdk

Android 版 Facebook SDK 不接受从 XML 传递的 login_text 和 logout_text 值。它只是忽略它。地球上没有使用此自定义按钮的文档/示例。

<com.facebook.widget.LoginButton
    xmlns:fb="http://schemas.android.com/apk/res-auto"
    android:id="@+id/connectWithFbButton"
    style="@style/com_facebook_loginview_default_style"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"
    android:layout_gravity="center_horizontal"
    android:text="@string/connect_with_facebook"
    fb:login_text="@string/connect_with_facebook"
    fb:logout_text="Connecting with facebook" />

它总是说登录或注销。我该如何使用这个属性?我尝试通过 LoginButton 代码进行调试,但没有成功。它从不通过 LoginButton() 的任何构造函数,因此无法解析我的自定义参数。

有人遇到过这个问题吗?

最佳答案

解决了!!

将名称为“com_facebook_loginview_log_in_button”的字符串添加到位于 res>values>strings.xml 中的 strings.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="com_facebook_loginview_log_in_button">Connect</string>
<string name="com_facebook_loginview_log_out_button">Your Logout</string>
</resources>

关于android - 适用于 Android 的 Facebook LoginButton 不采用从 XML 传递的 login_text 和 logout_text 值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15069969/

相关文章:

android - 在应用程序安装时将对象保存到内部存储

android - corona network.download() 不适用于 android

android - 布局中的 fragment 占位符

android - 在配置文件中打开 facebook 页面,形成一个原生的 android 应用程序

android - 卸载应用程序不会触发服务中的 onDestroy

Android 深度链接和 App 链接混淆

java - 一次写入一个值

java - 如何从以前布局的图片中清除内存?转到不同的布局/Activity 时如何清理内存?

Android Facebook 帐户工具包崩溃 - 缺少元数据 :/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CN

android - 无法使用适用于 Android 的 Facebook SDK 在 Facebook 上发布