Set Login/Logout Text for Button in Facebook Android SDK 4.0?

馋奶兔 提交于 2019-12-03 09:45:22
Murtaza Khursheed Hussain

use facebook:login_text and facebook: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>

Update: Possible cause

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

Update 2: Possible Solution

Override those strings in your strings.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>

Other strings can be found here

Just need change the attribute accordingly. Refer to : this

eg:

<com.facebook.login.widget.LoginButton
        xmlns:facebook="http://schemas.android.com/apk/res-auto"
        facebook:com_facebook_login_text="LOGIN"/>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!