I’m trying to change the text on facebook login button on Android.
I have gone through number of stackoverflow answers but none them worked. Is there a way to change it?
I have tried the answers in these links: 1, 2, 3.
If I use com.facebook.login.widget.LoginButton
button, I’m unable change the text on the button. (I’m able to login though)
<com.facebook.login.widget.LoginButton
android:id="@+id/fragment_login_fb_login_button"
android:layout_width="@dimen/fragment_login_fb_button_width"
android:layout_height="@dimen/fragment_login_fb_button_height"
android:layout_gravity="center"
android:layout_marginTop="@dimen/fragment_login_fb_button_top_margin"
android:background="@drawable/fragment_login_fb_login_button_background"
android:drawableLeft="@drawable/facebook_icon"
android:gravity="center"
android:text="@string/label_fragment_login_sign_in_with_facebook"
android:textColor="@android:color/white"
android:textStyle="bold"/>
If I use Button
I was able to change the text, but I’m unable to login.
<Button
android:id="@+id/fragment_login_fb_login_button"
android:layout_width="@dimen/fragment_login_fb_button_width"
android:layout_height="@dimen/fragment_login_fb_button_height"
android:layout_gravity="center"
android:layout_marginTop="@dimen/fragment_login_fb_button_top_margin"
android:background="@drawable/fragment_login_fb_login_button_background"
android:drawableLeft="@drawable/facebook_icon"
android:gravity="center"
android:text="@string/label_fragment_login_sign_in_with_facebook"
android:textColor="@android:color/white"
android:textStyle="bold"/>
I’m using android facebook sdk version 4.5.0
You can try to use facebook
namespace and set com_facebook_login_text
attribute for it
<com.facebook.login.widget.LoginButton
xmlns:facebook="http://schemas.android.com/apk/res-auto"
facebook:com_facebook_login_text="YourText"/>
Answer:
Please check the license agreement and you will see that you are not allowed to change it. Also you are not allowed to change the “f”. The only things that you are allowed by the license is to use different standard colors.
See 7.3 in fb and the brand allowed assets
Answer:
Its a trick not a proper method.
- Create a Relative layout.
- Define your facebook_botton.
- Also define your custom design button.
- Overlap them.
<RelativeLayout android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="30dp">
<com.facebook.login.widget.LoginButton
xmlns:facebook="http://schemas.android.com/apk/res-auto"
android:id="@+id/login_button"
android:layout_width="300dp"
android:layout_height="100dp"
android:paddingTop="15dp"
android:paddingBottom="15dp" />
<LinearLayout
android:id="@+id/llfbSignup"
android:layout_width="300dp"
android:layout_height="50dp"
android:background="@drawable/facebook"
android:layout_gravity="center_horizontal"
android:orientation="horizontal">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:src="@drawable/facbk"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/fullGray"
android:layout_marginLeft="10dp"/>
<com.yadav.bookedup.fonts.GoutamBold
android:layout_width="240dp"
android:layout_height="50dp"
android:text="Sign Up via Facebook"
android:gravity="center"
android:textColor="@color/white"
android:textSize="18dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"/>
</LinearLayout>
</RelativeLayout>
Answer:
Run on device not working in preview
<com.facebook.login.widget.LoginButton
android:layout_height="wrap_content"
android:id="@+id/signup_signupFacebookButton"
android:layout_width="fill_parent"
xmlns:facebook="http://schemas.android.com/apk/res-auto"
facebook:com_facebook_login_text="Sign up with Facebook"/>
Tags: androidandroid, button, facebook, login, text