Firebase身份验证中的Google和Facebook登录布局调整

问题描述 投票:0回答:2

我正在尝试将Firebase Authentication添加到我的应用中。由于我想要一致的布局,因此尝试在LinearLayout上调整Google登录按钮和Facebook登录按钮,如下所示:

![enter image description here但现在它们看起来像这样(Nexus 5X API 25):

enter image description here

或更糟糕的是,像这样(LG G7 ThinQ API 28:]]

enter image description here

我目前在我的XML布局中使用GooglesFacebooks开发人员页面中的正式代码

 <LinearLayout
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="7"
            android:orientation="vertical">


            <com.google.android.gms.common.SignInButton
                android:id="@+id/google_login_button"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

            <com.facebook.login.widget.LoginButton
                android:id="@+id/facebook_login_button"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

        </LinearLayout>

因此,我发现为了调整两个按钮,存在[[需要修复的两个主要方面

  1. 两个宽度之差
  • 文本的位置
  • 1)与Google的背景有一个小的盒子阴影有关。我已经尝试过使用边距/填充,并且我还使用了custom Google Log-In library来解决此问题。但是我快疯了。我的想法是测量Google框阴影用来替代Facebook按钮宽度中的该值的dps,但我不知道该怎么做。

    2)在这里,我还尝试调整了Facebook按钮,但它似乎不起作用。根据官方Sign-In Branding Guidelines from Google,徽标和文本之间的填充为24dp,但是当我在Facebook Button的徽标和文本之间添加24dp的填充时,它仍然看起来像这样:

    enter image description here

    也许有人经历过同样的斗争?有没有图书馆可以轻松做到这一点?感谢您的帮助。

    我正在尝试将Firebase身份验证添加到我的应用程序。因为我想要一个一致的布局,所以我尝试在LinearLayout上调整Google登录按钮和Facebook登录按钮,如下所示:但是...

    android firebase-authentication facebook-android-sdk google-authentication social-authentication
    2个回答
    0
    投票
    我认为您可以按如下所示从布局中设置按钮的宽度和高度。

    <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <com.google.android.gms.common.SignInButton android:id="@+id/google_login_button" android:layout_width="200dp" android:layout_height="80dp" /> <com.facebook.login.widget.LoginButton android:id="@+id/facebook_login_button" android:layout_width="200dp" android:layout_height="80dp" /> </LinearLayout>


    0
    投票
    也许有帮助。
    © www.soinside.com 2019 - 2024. All rights reserved.