Android - Google SignInButton 文本未居中

标签 android google-signin

我想在我的一个布局中使用 com.google.android.gms.common.SignInButton 但遗憾的是,没有任何有值(value)的理由,按钮内的文本没有想成为中心。

这是它的样子:

enter image description here

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>

编辑:

即使 Activity 完全为空,此按钮也无法正确显示......我疯了吗?

enter image description here

有人遇到过这个问题吗?

谢谢

最佳答案

用这个

  compile 'com.google.android.gms:play-services-auth:9.8.0'

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">


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

enter image description here

关于Android - Google SignInButton 文本未居中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42150259/

相关文章:

ios - Google SignIn 出现异常

安卓布局 : Can't place the elements where I want

java - 我的上一个 ImageView 图像按钮不起作用

Android C2DM 注册 ID

android - 以编程方式启用定位模式高精度或省电,无需用户访问设置

android - WebView.draw(android.graphics.Canvas) 不会将 HTML5 Canvas 绘制到 android.graphics.Canvas

ios - 什么是 APP_CLIENT_ID 和 SERVER_CLIENT_ID,我在哪里可以找到它们?

c# - 谷歌授权错误错误400 : redirect_uri_mismatch

swift - 注销 Facebook 和 Google

node.js - 使用 Passport js 登录 google