Android google plus login button style

I need a long style button for google + signin in android.

In accordance with the recommendations of branding, there are different styles for the button, such as long, medium, short, etc.

I get a middle-style button using an example application, but I need a long-style button.

here is my button

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

`

+6
source share
3 answers

As described on the site, there is a button size 3

  • Icon only = SignInButton.SIZE_ICON_ONLY
  • Normal button = SignInButton.SIZE_STANDARD
  • Wide button = SignInButton.SIZE_WIDE

You can use it like that.

 gSignInButton = (SignInButton) findViewById(R.id.sign_in_button); gSignInButton.setOnClickListener(this); gSignInButton.setEnabled(true); gSignInButton.setSize(SignInButton.SIZE_WIDE);// wide button style 
+16
source

You can do this using XML by adding and using the app namespace (since these are custom attributes):

 <com.google.android.gms.common.SignInButton xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/sign_in_button" android:layout_width="wrap_content" android:layout_height="wrap_content" app:buttonSize="wide" app:colorScheme="dark" /> 

Possible attribute values:

  • buttonSize: "wide", "icon_only" or "standard" (default)
  • colorScheme: "dark", "light" & "auto" (default)
+5
source

You can use the setSize method of the Signin button to update the size.

For example, in my activity onCreate method:

  mSignInButton = (SignInButton) findViewById(R.id.sign_in_button); mSignInButton.setOnClickListener(this); mSignInButton.setSize(SignInButton.SIZE_WIDE); 

The login button will change.

You can also simply use the ANY button, which is properly branded simply by using the A button, and then using this operation as a button click handler.

+3
source

All Articles