BruceLee BruceLee - 2 years ago 141
Android Question

How to change SignInButton's text?

In my app, I use SignInButton, the text on it is default "登录", like this:
login sample

But I want to change the default text to "Google login". I refer to the official tutorial, however, find no meaningful answer. I hope someone can help, Thanks a lot.

Answer Source

As SignInButton extends FrameLayout, So it has no function to setText. I think you can use below code to realize your goal:

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;
} }

Another way, try to write your custom login button, which is an easy case, as @NIPHIN says. Hope this answer will solver your question.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download