Android Google plus login button style

后端 未结 4 2042
后悔当初
后悔当初 2021-01-02 12:00

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

According to the Branding guidelines here there are different styles for the button like long, medium, sh

相关标签:
4条回答
  • 2021-01-02 12:36

    As the website described there are 3 sized button

    1. Icon only = SignInButton.SIZE_ICON_ONLY
    2. Normal button = SignInButton.SIZE_STANDARD
    3. 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
    
    0 讨论(0)
  • 2021-01-02 12:45

    Just make this button visibility View.GONE, make your custom button and send onclick event from your button to SignInButton.performClick()

    0 讨论(0)
  • 2021-01-02 12:49

    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.

    0 讨论(0)
  • 2021-01-02 12:51

    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)
    0 讨论(0)
提交回复
热议问题