简体   繁体   中英

switching the google sign in button android

I am pretty new with android and I want to switch the google sign in button image with my own designed one, how can I do it?

Here is my current google button(In which I want to switch the image but cant..)

<com.google.android.gms.common.SignInButton
    android:id="@+id/sign_in_button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"
    android:visibility="visible"
    android:src="@drawable/login"
    android:layout_gravity="center |bottom"/>

try it

<Button
    android:id="@+id/btnLoginGoogle"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_marginLeft="@dimen/activity_horizontal_margin"
    android:padding="5dp"
    android:layout_marginRight="@dimen/activity_horizontal_margin"
    android:drawableLeft="@drawable/google_icon"
    android:background="@drawable/bg_google_btn"/>

onClick

case R.id.btnLoginGoogle:
    loginWithGoogle();
    break;

public void loginWithGoogle(){
     try {
        Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
        startActivityForResult(signInIntent, RC_GET_TOKEN);
    }catch (Exception e){
        e.printStackTrace();
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM