Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/209.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何定制谷歌登录按钮?_Android_Xml_Android Layout - Fatal编程技术网

Android 如何定制谷歌登录按钮?

Android 如何定制谷歌登录按钮?,android,xml,android-layout,Android,Xml,Android Layout,我想根据我的设计定制谷歌登录按钮 图像已附加 在UI中创建任意按钮,并在单击按钮时调用此功能 public void gPlusSignIn() { GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestEmail() .build(); GoogleApiClient mGoogleApiCli

我想根据我的设计定制谷歌登录按钮

图像已附加


在UI中创建任意按钮,并在单击按钮时调用此功能

public void gPlusSignIn() {
    GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
        .requestEmail()
        .build();

    GoogleApiClient mGoogleApiClient = new GoogleApiClient.Builder(YourActivity.this)
        .enableAutoManage(YourActivity.this /* Activity */
                , this /* OnConnectionFailedListener */)
        .addApi(Auth.GOOGLE_SIGN_IN_API, gso)
        .build();

    Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
    startActivityForResult(signInIntent, RC_SIGN_IN);
}
Google将以onActivityResult方法为您提供登录响应:

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == RC_SIGN_IN) {
        GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
            if (result.isSuccess()) {
                GoogleSignInAccount acct = result.getSignInAccount();
                //get user's email
                String mEmail = acct.getEmail();

                //get user's full name
                String mFullName = acct.getDisplayName();

                String gPlusID = acct.getId();
            }
    }
}

您可以将任何按钮作为谷歌登录按钮创建框架布局,将您的
按钮置于默认谷歌登录按钮下方。同样,我们也可以为facebook使用任何按钮@jagapathiyes我们可以@sunilpi如果我们也为facebook使用任何按钮,我们会获得registerCallback方法吗@贾加帕蒂