Android - Google SignInButton text not centered

I would like to use com.google.android.gms.common.SignInButtonin one of my layouts, but, unfortunately, and without any important reason, the text inside the button does not want to be in the center.

Here's what it looks like:

enter image description here

xml is really simple, and I tried playing with field / padding / gravity / ... but nothing works to center the text:

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

EDIT:

Even with completely empty activity, this button does not display correctly ... Am I crazy?

enter image description here

Has anyone already encountered this problem?

thank

+4
source share
3 answers
  • Check the version of the Google gaming services, I would prefer to use compile 'com.google.android.gms:play-services-auth:9.8.0'as indicated in the document
  • , extras @SDK Manager.
  • , , , .
  • , , .

Google - , , , , , .

enter image description here

Google . , . , , setOnClickListener(OnClickListener).

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

+3

  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

0
  <com.google.android.gms.common.SignInButton
                android:id="@+id/sign_in_button"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:layout_gravity="center"
                />


Use android:layout_gravity="center" 
-1
source

Source: https://habr.com/ru/post/1669329/


All Articles