SamYan
SamYan

Reputation: 1571

Custom Button with Facebook SDK 4 (Android)

I'm trying to customize the login button in Facebook SDK 4.0 (Android) but no way... I was looking in Fb Docs but no results. Any idea please ?

Thanks in advance!

Upvotes: 0

Views: 1597

Answers (2)

Driss Baidou
Driss Baidou

Reputation: 305

for New Facebook SDK (4+) you might use this code to customize your Button text

<com.facebook.login.widget.LoginButton
    xmlns:facebook="http://schemas.android.com/apk/res-auto"
    facebook:com_facebook_login_text="Custom Login text"
    ...
/>

Upvotes: 0

Logic
Logic

Reputation: 2258

Your Button

<com.facebook.widget.LoginButton
    xmlns:fb="http://schemas.android.com/apk/res-auto"
    android:id="@+id/login_button"
    android:layout_width="249dp"
    android:layout_height="45dp"
    android:layout_above="@+id/textView1"
    android:layout_centerHorizontal="true"
    android:layout_gravity="center_horizontal"
    android:layout_marginBottom="30dp"
    android:layout_marginTop="30dp"
    android:contentDescription="@string/login_desc"
    android:scaleType="centerInside"
    fb:login_text=""
    fb:logout_text="" />

and in your Activity

LoginButton authbutton = (LoginButton) findViewById(R.id.login_button);
authbutton.setBackgroundResource(R.drawable.facebook);
authButton.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0,0);

Upvotes: 4

Related Questions