SignInButton

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

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.

Nested Class Summary

@interface SignInButton.ButtonSize Size constants - enumeration of supported sizes. 
@interface SignInButton.ColorScheme Color constants - enumeration of supported color schemes. 

Constant Summary

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.

Inherited Constant Summary

Inherited Field Summary

Public Constructor Summary

SignInButton(Context context, AttributeSet attrs, int defStyle)

Public Method Summary

void
onClick(View view)
void
setColorScheme(int colorScheme)
void
setEnabled(boolean enabled)
void
void
setScopes(Scope[] scopes)
void
setSize(int buttonSize)
void
setStyle(int buttonSize, int colorScheme, Scope[] scopes)
void
setStyle(int buttonSize, int colorScheme)

Constants

public static final int COLOR_AUTO

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

Constant Value: 2

public static final int COLOR_DARK

The dark color scheme of the sign-in button.

Constant Value: 0

public static final int COLOR_LIGHT

The light color scheme of the sign-in button.

Constant Value: 1

public static final int SIZE_ICON_ONLY

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

Constant Value: 2

public static final int SIZE_STANDARD

The standard size of the Google sign-in button.

Constant Value: 0

public static final int SIZE_WIDE

The wide size of the Google sign-in button.

Constant Value: 1

Public Constructors

public SignInButton (Context context)

public SignInButton (Context context, AttributeSet attrs)

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

Public Methods

public void onClick (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 The color scheme to use for the button. See SignInButton.ColorScheme

public void setEnabled (boolean enabled)

public void setOnClickListener (View.OnClickListener listener)

public void setScopes (Scope[] scopes)

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 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 The size of the button to display. See SignInButton.ButtonSize

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

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 The size of the button to display. See SignInButton.ButtonSize
colorScheme The color scheme to use for the button. See SignInButton.ColorScheme
scopes 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 The size of the button to display. See SignInButton.ButtonSize
colorScheme The color scheme to use for the button. See SignInButton.ColorScheme