Android – Google SignInButton文字不居中

我想在我的一个布局中使用com.google.
android.gms.common.SignInButton但遗憾的是,没有任何有价值的理由,按钮内的文本不希望位于中心.

这是它的样子:

《Android – Google SignInButton文字不居中》

xml非常简单,我尝试使用margin / padding / gravity / …但没有任何方法可以使文本居中:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <include layout="@layout/toolbar" />

    <com.google.android.gms.common.SignInButton
        android:id="@+id/button_google_sign_in"
        android:layout_width="200dp"
        android:layout_height="60dp"
        android:layout_centerInParent="true" />

</RelativeLayout>

编辑:

即使是完全空的活动,这个按钮也无法正确显示……我疯了吗?

《Android – Google SignInButton文字不居中》

有人已经遇到过这个问题吗?

谢谢

最佳答案 >查看您的google play-services版本,

我希望您使用
document中提到的编译’com.google.android.gms:play-services-auth:9.8.0′

>检查您的额外内容@ SDK Manager是否有任何游戏服务更新

>要确认问题与您安装的任何东西有关,您可以在另一台PC上运行您的项目

>最后,如果你无法解决问题,可以选择
Customizing the Sign-In Button.

此Google登录按钮实际上并不执行任何特殊功能,但是有法律限制,因为您想使用相同的背景作为替代方案,您可以使用自定义登录按钮将背景保存为image.

《Android – Google SignInButton文字不居中》

The Google sign-in button to authenticate the user. Note that this
class only handles the visual aspects of the button. In order to
trigger an action, register a listener using
setOnClickListener(OnClickListener).

 https://developers.google.com/android/reference/com/google/android/gms/common/SignInButton

点赞