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

为君一笑 提交于 2019-12-18 12:43:23

问题


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?


回答1:


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



回答2:


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!!




回答3:


There is no need to create a custom LoginButton.

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



来源:https://stackoverflow.com/questions/29589208/how-to-change-the-height-of-the-log-in-with-facebook-button

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!