dora dora - 1 month ago 37
Android Question

customize Android Facebook Login button

i want to customize the look of the facebook login button which we get along with the facebook sdk for android (facebook-android-sdk-3.0.1). i want a simple android button which has title "Login via facebook". i could not find any documentation regarding that.

so if any one knows on how to do it in a simple way, please tell me or direct me on how to do it.

Answer

You can use styles for modifiy the login button like this

<style name="FacebookLoginButton">
    <item name="android:textSize">@dimen/smallTxtSize</item>
    <item name="android:background">@drawable/facebook_signin_btn</item>
    <item name="android:layout_marginTop">10dp</item>
    <item name="android:layout_marginBottom">10dp</item>
    <item name="android:layout_gravity">center_horizontal</item>
</style>

and in layout

<com.facebook.widget.LoginButton
        xmlns:fb="http://schemas.android.com/apk/res-auto"
        android:id="@+id/loginFacebookButton"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        fb:login_text="@string/loginFacebookButton"
        fb:logout_text=""
        style="@style/FacebookLoginButton"/>