How to change the height of the 'Log in with Facebook' button?

AndroidFacebookAndroid XmlFacebook LoginFacebook Sdk-4.0

Android Problem Overview


I already tried several answers I could find but none of them worked with the latest Facebook Android SDK version 4.0.

How can I change the layout height with the latest SDK?

Android Solutions


Solution 1 - Android

Just set paddingTop and paddingBottom. It works for me.

<com.facebook.login.widget.LoginButton
        android:id="@+id/login_facebook_button"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingTop="15dp"
        android:paddingBottom="15dp"
        android:layout_marginRight="30dp"
        android:layout_marginLeft="30dp"/>

Solution 2 - Android

For Facebook SDK v4.x (or rather than using separate xml style or programmatically)

The height of button is decided by its padding and textSize.

So if you want to increase button size, do it something like this

<com.facebook.login.widget.LoginButton
xmlns:facebook="http://schemas.android.com/apk/res-auto"
facebook:com_facebook_login_text="Log in with Facebook"
android:id="@+id/login_button"
android:textSize="15sp"
android:paddingTop="15dp" <!--increase more until it matches ur requirement -->
android:paddingBottom="15dp">

Hope it helps!!

Solution 3 - Android

There is no need to create a custom LoginButton.

You can just change the LoginButton parameters programmatically as described here.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSteffenView Question on Stackoverflow
Solution 1 - AndroidTiago MartinsView Answer on Stackoverflow
Solution 2 - AndroidRafique MohammedView Answer on Stackoverflow
Solution 3 - AndroidSteffenView Answer on Stackoverflow