Android Google plus login button style
As the website described there are 3 sized button
- Icon only = SignInButton.SIZE_ICON_ONLY
- Normal button = SignInButton.SIZE_STANDARD
- Wide button = SignInButton.SIZE_WIDE
You can use it like this.
gSignInButton = (SignInButton) findViewById(R.id.sign_in_button);
gSignInButton.setOnClickListener(this);
gSignInButton.setEnabled(true);
gSignInButton.setSize(SignInButton.SIZE_WIDE);// wide button style
You can do it with XML by adding & using the app
namespace (as they 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 attributes values are:
- buttonSize:
"wide", "icon_only" or "standard"
(default) - colorScheme:
"dark", "light" & "auto"
(default)
You can use the setSize method of the Signin button to update the size.
For example, in my activity's onCreate
method:
mSignInButton = (SignInButton) findViewById(R.id.sign_in_button);
mSignInButton.setOnClickListener(this);
mSignInButton.setSize(SignInButton.SIZE_WIDE);
will change the Sign-In button to be wide.
You can also just use ANY button that is appropriately branded by just using a Button and then using the activity as the button's click handler.