Google+ 我的应用程序中的登录按钮(不是 G)集成
Google+ login Button(not G) integration in my app
我试图实现 Google+ 登录我的应用程序一切正常,但我想要红色 google+ 按钮,它显示白色 Google 按钮我通过分配完成前景图像但不如原始图像
我通过简单地使用 setScope 完成了
SignInButton signInButton = (SignInButton) findViewById(R.id.sign_in_button);
signInButton.setSize(SignInButton.SIZE_STANDARD);
signInButton.setScopes(new Scope[]{Plus.SCOPE_PLUS_LOGIN});
因为,你更新了播放服务到8.4.0。您可以通过自定义登录按钮来实现。
在 play-services-8.1.0 中 google+ 按钮显示红色 color.After google 从 8.4.0 更新了该逻辑。我建议您为 Google+ 登录创建自定义按钮。
您可以在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();
希望对您有所帮助!
我试图实现 Google+ 登录我的应用程序一切正常,但我想要红色 google+ 按钮,它显示白色 Google 按钮我通过分配完成前景图像但不如原始图像
我通过简单地使用 setScope 完成了
SignInButton signInButton = (SignInButton) findViewById(R.id.sign_in_button);
signInButton.setSize(SignInButton.SIZE_STANDARD);
signInButton.setScopes(new Scope[]{Plus.SCOPE_PLUS_LOGIN});
因为,你更新了播放服务到8.4.0。您可以通过自定义登录按钮来实现。
在 play-services-8.1.0 中 google+ 按钮显示红色 color.After google 从 8.4.0 更新了该逻辑。我建议您为 Google+ 登录创建自定义按钮。
您可以在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();
希望对您有所帮助!