public final class

SignInButton

extends FrameLayout
implements View.OnClickListener
java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.widget.FrameLayout
         ↳ com.google.android.gms.common.SignInButton

Class Overview

The Google sign-in button to authenticate the user. Note that this class only handles the visual aspects of the button. In order to trigger an action, register a listener using setOnClickListener(OnClickListener).

Note that you must explicitly call setOnClickListener(OnClickListener). Do not register a listener via XML, or you won't receive your callbacks.

Summary

Nested Classes
@interface SignInButton.ButtonSize Size constants - enumeration of supported sizes. 
@interface SignInButton.ColorScheme Color constants - enumeration of supported color schemes. 
Constants
int COLOR_AUTO Google Play services will decide the color scheme for sign-in button.
int COLOR_DARK The dark color scheme of the sign-in button.
int COLOR_LIGHT The light color scheme of the sign-in button.
int SIZE_ICON_ONLY The icon-only size of the Google sign-in button.
int SIZE_STANDARD The standard size of the Google sign-in button.
int SIZE_WIDE The wide size of the Google sign-in button.
[Expand]
Inherited Constants
From class android.view.ViewGroup
From class android.view.View
[Expand]
Inherited Fields
From class android.view.View
Public Constructors
SignInButton(Context context)
SignInButton(Context context, AttributeSet attrs)
SignInButton(Context context, AttributeSet attrs, int defStyle)
Public Methods
void onClick(View view)
void setColorScheme(int colorScheme)
Set the color scheme of the button to use.
void setEnabled(boolean enabled)
void setOnClickListener(View.OnClickListener listener)
void setScopes(Scope[] scopes)
This method is deprecated. Setting scopes will no longer impact the branding.
void setSize(int buttonSize)
Set the size of the button to use.
void setStyle(int buttonSize, int colorScheme, Scope[] scopes)
This method is deprecated. Setting scopes will no longer impact the branding. Use setStyle(int, int) instead.
void setStyle(int buttonSize, int colorScheme)
Set the desired style of button to use.
[Expand]
Inherited Methods
From class android.widget.FrameLayout
From class android.view.ViewGroup
From class android.view.View
From class java.lang.Object
From interface android.view.ViewParent
From interface android.view.ViewManager
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.accessibility.AccessibilityEventSource
From interface android.view.View.OnClickListener

Constants

public static final int COLOR_AUTO

Google Play services will decide the color scheme for sign-in button.

Constant Value: 2 (0x00000002)

public static final int COLOR_DARK

The dark color scheme of the sign-in button.

Constant Value: 0 (0x00000000)

public static final int COLOR_LIGHT

The light color scheme of the sign-in button.

Constant Value: 1 (0x00000001)

public static final int SIZE_ICON_ONLY

The icon-only size of the Google sign-in button.

Constant Value: 2 (0x00000002)

public static final int SIZE_STANDARD

The standard size of the Google sign-in button.

Constant Value: 0 (0x00000000)

public static final int SIZE_WIDE

The wide size of the Google sign-in button.

Constant Value: 1 (0x00000001)

Public Constructors

public SignInButton (Context context)

Parameters
context Context

public SignInButton (Context context, AttributeSet attrs)

Parameters
context Context
attrs AttributeSet

public SignInButton (Context context, AttributeSet attrs, int defStyle)

Parameters
context Context
attrs AttributeSet
defStyle int

Public Methods

public void onClick (View view)

Parameters
view View

public void setColorScheme (int colorScheme)

Set the color scheme of the button to use. The size and branding scheme will remain unchanged.

Parameters
colorScheme int: The color scheme to use for the button. See SignInButton.ColorScheme

public void setEnabled (boolean enabled)

Parameters
enabled boolean

public void setOnClickListener (View.OnClickListener listener)

Parameters
listener View.OnClickListener

public void setScopes (Scope[] scopes)

This method is deprecated.
Setting scopes will no longer impact the branding.

Set the scopes your app will use to sign in and the sign in button will choose the right branding for you. The color scheme and the size will remain unchanged.

Parameters
scopes Scope: A scope array.

public void setSize (int buttonSize)

Set the size of the button to use. The color and branding scheme will remain unchanged.

Parameters
buttonSize int: The size of the button to display. See SignInButton.ButtonSize

public void setStyle (int buttonSize, int colorScheme, Scope[] scopes)

This method is deprecated.
Setting scopes will no longer impact the branding. Use setStyle(int, int) instead.

Set the desired style of button to use. This will update the button to use the specified size, color scheme and corresponding branding.

Parameters
buttonSize int: The size of the button to display. See SignInButton.ButtonSize
colorScheme int: The color scheme to use for the button. See SignInButton.ColorScheme
scopes Scope: The scopes your app will use to sign in.

public void setStyle (int buttonSize, int colorScheme)

Set the desired style of button to use. This will update the button to use the specified size and color scheme.

Parameters
buttonSize int: The size of the button to display. See SignInButton.ButtonSize
colorScheme int: The color scheme to use for the button. See SignInButton.ColorScheme