Android Google plus Sign out button looks different from sign in button in Google tutorial docs

孤街醉人 提交于 2020-01-24 02:40:06

问题


I am following the steps mentioned in Google developers site to implement sign in and sign out in my app.

The code to add the sign-in and sign-out button as mentioned there is:

<!-- sign-in button -->
<com.google.android.gms.common.SignInButton
    android:id="@+id/sign_in_button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

<!-- sign-out button -->
<Button
    android:id="@+id/sign_out_button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Sign Out"
    android:visibility="gone" />

In the sample mentioned over there, the sign out button looks very different(and odd) from the sign out button.

Is this because the sign out button is not taken from com.google.android.gms?

Is there a proper sign-out button available in com.google.android.gms?


回答1:


There is no sign-out button provided by google.

If you would like extra buttons in the same style as google's, you will need to create them yourself.

But it's a lot easier than it sounds, there are many resources provided by Google to show you how to create a button that looks just like a Google button. Take a look over here:

https://developers.google.com/+/branding-guidelines

Here is a little example I made in microsoft paint to show you the kind of stuff you can make!




回答2:


You can make your button look the same as <com.google.android.gms.common.SignInButton>, adding a predefined style to your button with the xml tag style:

style="@style/FirebaseUI.Button.AccountChooser.GoogleButton"

Note that its a FirebaseUI style and you can put the Button text that you want.



来源:https://stackoverflow.com/questions/25022861/android-google-plus-sign-out-button-looks-different-from-sign-in-button-in-googl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!