如何更改 'Log in with Facebook' 按钮的高度?

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

我已经尝试了几个我能找到的答案,但 none 与最新的 Facebook Android SDK 版本 4.0 兼容。

如何使用最新的SDK更改布局高度?

无需创建自定义 LoginButton

您可以按照 所述以编程方式更改 LoginButton 参数。

只需设置 paddingTop 和 paddingBottom。对我有用。

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

对于 Facebook SDK v4.x或使用单独的 xml 样式或以编程方式

按钮的height由其paddingtextSize决定。

所以如果你想增加按钮的大小,像这样做

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

希望对您有所帮助!!