且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在Facebook Android SDK 4.0中设置按钮的登录/注销文本?

更新时间:2023-10-11 21:55:22

使用 facebook:login_text :logout_text

 <com.facebook.widget.LoginButton
            android:id="@+id/login_button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="5dp"
            facebook:confirm_logout="false"
            facebook:fetch_user_info="true"
            android:text="testing 123"
            facebook:login_text="LOGIN"
            facebook:logout_text="LOGOUT"
            />

如果上述无效,请尝试在您的值文件夹中添加以下内容

If the above doesnt work, try to add following in your values folder

<resources>
<string name="com_facebook_loginview_log_in_button">LOGIN</string>
<string name="com_facebook_loginview_log_out_button">LOGOUT</string>
</resources>

更新:可能的原因

https://github.com/facebook/facebook-android-sdk/blob/master/facebook/src/com/facebook/login/widget/LoginButton.java#L599

更新2:可能的解决方案

覆盖字符串中的这些字符串.xml

<string name="com_facebook_loginview_log_out_button">Log out</string>
<string name="com_facebook_loginview_log_in_button">Log in</string>
<string name="com_facebook_loginview_log_in_button_long">Log in with Facebook</string>

可以找到其他字符串这里