I am trying to add 'Sign in with Google' feature on my app. I am using following code to add google sign in button
<com.google.android.gms.common.SignInButton
android:id="@+id/btn_google_signin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:background="?attr/selectableItemBackground"
android:elevation="2dp"></com.google.android.gms.common.SignInButton>
This is rendering a rectangular button. But i want round corner button. is there any way to customize this button with round corner?
P.S. - I am not looking to customize the normal button. I am specifically looking Google SignInButton. Please reply if you know about that only.
You can use the Material button with SignInButton like this,
<com.google.android.gms.common.SignInButton
android:id="@+id/sign_in_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
/>
<com.google.android.material.button.MaterialButton
android:id="@+id/sign_in_button1"
android:layout_width="300dp"
android:layout_height="60dp"
app:cornerRadius="10dp"
android:layout_weight="1"
android:backgroundTint="@color/white"
android:text="Login With Google"
android:textColor="@color/black"
app:icon="@drawable/googleg_standard_color_18"
app:iconPadding="10dp"
app:iconTint="#00100D0D"
app:iconTintMode="src_atop"
/>
And in Java code you can access it like this:
SignInButton signInButton = findViewById(R.id.sign_in_button);
signInButton.setSize(SignInButton.SIZE_STANDARD);
TextView textView = (TextView) signInButton.getChildAt(0);
textView.setText("Log in With Google");
findViewById(R.id.sign_in_button1).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent signInIntent = mGoogleSignInClient.getSignInIntent();
startActivityForResult(signInIntent, RC_SIGN_IN);
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With