Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I edit the text of sign in button on Google?

I am integrating my application with google plus. I have installed google play services and signed in to my account. Also I could publish and plus one for what ever I want.

My problem

I can't change the text of the sign in button.

My code

<com.google.android.gms.common.SignInButton         android:id="@+id/share_button"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_gravity="center_horizontal"         android:text="Share on Google+" /> 

What I have tried?

  • First, I tried adding this line to the xml

    android:text="Share on Google+" 
  • Secondly, I tried to set the text programmatically, however it didn't work.

Any help would be appreciated.

Edit

If it is not possible, is there any way so I can use the same google sign in button on another button?

like image 852
Marco Dinatsoli Avatar asked Aug 04 '13 07:08

Marco Dinatsoli


People also ask

How do I change the Google sign-in button text?

Or based on whether it is a sign-in or sign-up flow, you want to switch between “Sign in with Google” and “Sign up with Google” text. As you might already know, to set the text on an Android Button , you can use android:text="{string}" attribute in your layout XML.

How do I use Google button?

Add a Sign In With Google button to your site to enable users to sign-up or sign-in to your web app. Use either HTML or JavaScript to render the button and attributes to customize the button shape, size, text, and theme.

How do I create a Google sign-in HTML?

Add Google Sign-In to Your Web App console. log("ID: " + profile. getId()); // Don't send this directly to your server!


2 Answers

Here is the easiest way that I used:

    TextView textView = (TextView) signInButton.getChildAt(0);     textView.setText("your_text_xyz"); 
like image 45
Sankar Behera Avatar answered Nov 02 '22 02:11

Sankar Behera


Here is the technique that I used:

protected void setGooglePlusButtonText(SignInButton signInButton, String buttonText) {     // Find the TextView that is inside of the SignInButton and set its text     for (int i = 0; i < signInButton.getChildCount(); i++) {         View v = signInButton.getChildAt(i);          if (v instanceof TextView) {             TextView tv = (TextView) v;             tv.setText(buttonText);             return;         }     } } 
like image 118
w.donahue Avatar answered Nov 02 '22 03:11

w.donahue



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!