Java – Customize Google SignInButton in Android

Customize Google SignInButton in Android… here is a solution to the problem.

Customize Google SignInButton in Android

I want to customize the Google sign-in button in Android. Currently I have a very basic default layout, use the following code.

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

I’m not happy with the current button layout. Is it possible to update the button text, background color, or should I create a full custom button layout?

Thank you.

PS: I am new to Android

Solution

Quite simply, you need to do this

<Button
 android:id="@+id/button"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_centerHorizontal="true"
 android:text="@string/common_signin_button_text_long" />

You can customize the button, but you must make sure to follow the guidelines guidelines.
EDIT: View this library custom signin button

If you want to do it yourself, you can create a linear layout and add images.

Related Problems and Solutions