android Google plus登录自定义 [英] android Google plus login customization

查看:52
本文介绍了android Google plus登录自定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个Android应用程序,现在正在实现社交网络登录.

I'm creating a Android application and right now i'm implementing the social networks login.

Facebook按钮很好,但是google +按钮使用的是Facebook的另一种语言.另外,它只说登录",我想让它说用Google登录"

Facebook button is fine, but the google+ button is in a different language of the facebook one. Also, it only says "sign in", and i would like to have it to say "sign in with google"

我是android编程的新手,看到我需要做一个自定义按钮,但是不知道该怎么做(从哪里开始,如何调用它)并使它​​看起来像google加一个.

I'm new to the android programation, and saw that i need to make a custom button, but dont know how to do it(where to start it, how to call it) and make it look like google plus one.

有人可以给我一点帮助吗?

Could anyone give me a little bit of help?

谢谢

推荐答案

我发现了两种方法:

1)使用自定义按钮进行战斗:

1) Fight it with a custom button:

<Button
    android:id="@+id/btnGooglePlus"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:background="@drawable/common_signin_btn_text_dark"
    android:text="@string/common_signin_button_text_long"
    android:textColor="@android:color/white"
    android:textAllCaps="false"
    android:textSize="15sp"
    android:paddingEnd="16dp"
    android:paddingStart="62dp"/>

2)不要打架(太多):

2) Don't fight it (too much):

<com.google.android.gms.common.SignInButton
    android:id="@+id/btnGooglePlus"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"/>

mGooglePlusSignInButton = (SignInButton) findViewById(R.id.btnGooglePlus);
mGooglePlusSignInButton.setSize(SignInButton.SIZE_WIDE);
setGooglePlusTextAllCaps(mGooglePlusSignInButton, false);

public static void setGooglePlusTextAllCaps(SignInButton signInButton, boolean allCaps)
{
    for (int i = 0; i < signInButton.getChildCount(); i++)
    {
        View v = signInButton.getChildAt(i);

        if (v instanceof TextView)
        {
            TextView tv = (TextView) v;
            tv.setAllCaps(allCaps);
            return;
        }
    }
}

主要技巧似乎是"mGooglePlusSignInButton.setSize(SignInButton.SIZE_WIDE);"方法.

The main trick seems to be the "mGooglePlusSignInButton.setSize(SignInButton.SIZE_WIDE);" method.

这篇关于android Google plus登录自定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆