我的应用

时间:2016-02-02 08:39:01

标签: android google-plus

我尝试实施Google+登录我的应用程序一切正常,但我想要红色的Google +按钮&它显示了白色的谷歌按钮,我通过分配前景图像完成它,但它不如orignal
actually what i want is that

what i get

3 个答案:

答案 0 :(得分:1)

我只是使用setScope

完成的

SignInButton signInButton = (SignInButton) findViewById(R.id.sign_in_button); signInButton.setSize(SignInButton.SIZE_STANDARD); signInButton.setScopes(new Scope[]{Plus.SCOPE_PLUS_LOGIN});

答案 1 :(得分:1)

因为,您将播放服务更新为8.4.0。您可以通过自定义登录按钮来实现此目的。

在play-services-8.1.0中,谷歌+按钮显示为红色。之后谷歌从8.4.0更新了该逻辑。我建议您为Google+登录创建自定义按钮。

答案 2 :(得分:1)

您可以在此Google示例代码中找到以下内容:

    // [START customize_button]
    // Customize sign-in button. The sign-in button can be displayed in
    // multiple sizes and color schemes. It can also be contextually
    // rendered based on the requested scopes. For example. a red button may
    // be displayed when Google+ scopes are requested, but a white button
    // may be displayed when only basic profile is requested. Try adding the
    // Scopes.PLUS_LOGIN scope to the GoogleSignInOptions to see the
    // difference.
    SignInButton signInButton = (SignInButton) findViewById(R.id.sign_in_button);
    signInButton.setSize(SignInButton.SIZE_STANDARD);
    signInButton.setScopes(gso.getScopeArray());
    // [END customize_button]

因此,您可以使用以下内容:

GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
            .requestScopes(new Scope(Scopes.PLUS_LOGIN))                
            .requestEmail()
            .build();

希望它有所帮助!