android - 如何更改facebook登录按钮上的文字

时间:2015-09-20 06:28:09

标签: android facebook-login facebook-android-sdk

我正在尝试更改Android上的facebook登录按钮上的文字。

我已经完成了一些stackoverflow的答案,但没有一个工作。有没有办法改变它?

我在以下链接中尝试了答案:123

如果我使用com.facebook.login.widget.LoginButton按钮,则无法更改按钮上的文字。 (我可以登录)

<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"/>

如果我使用Button我可以更改文字,但我无法登录。

<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"/>

我正在使用android facebook sdk version 4.5.0

3 个答案:

答案 0 :(得分:0)

请检查许可协议,您将看到不允许更改它。此外,您不能更改“f”。许可证允许的唯一事项是使用不同的标准颜色。 请参阅fb中的7.3和允许的品牌assets

答案 1 :(得分:0)

这不是一个合适的方法。

  • 创建相对布局。
  • 定义你的facebook_botton。
  • 还要定义自定义设计按钮。
  • 重叠他们。
<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>

答案 2 :(得分:0)

在未预览的设备上运行

       <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"/>