Android Google Login Button and Facebook sdk 4+ Bu

2019-04-04 06:50发布

I Am developing an application which use google and facebook integration ...I want to fix height and width of those button...and i want to set Button Text Manualy...

i had tried so far

<com.facebook.login.widget.LoginButton
       xmlns:fb="http://schemas.android.com/apk/res-auto"
       android:id="@+id/connectWithFbButton"  
       android:layout_width="match_parent"
       android:layout_height="50dp"
       android:layout_marginLeft="10dp"
       android:layout_marginRight="10dp"
       android:text="@string/fbloginText"
       android:layout_marginTop="30dp"
/>

<com.google.android.gms.common.SignInButton
        android:id="@+id/signin"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:text="@string/googleloginText" 
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:layout_marginTop="20dp"/>

although i had attemted something like this

    fb:login_text="Login"
    fb:logout_text="Logout"

         or 

    facebook:login_text="Login" 

But i Got Error::=>No resource identifier found for attribute 'login_text' in package 'com.test.b2c'

or in by coding

    loginButton = (LoginButton) findViewById(R.id.connectWithFbButton);
     loginButton.setText("Login");

Now My layout Look Something Like This

enter image description here

I also want to set Height And width of this buttons .. ... help me friends .....thx in advance

UPDATE

I have no direct problem in setting width what am I really concern is the inconsistent HEIGHT shown in the picture. I need to find better way(s) to make those buttons height equally nd set Text to those Button.

enter image description here

7条回答
看我几分像从前
2楼-- · 2019-04-04 07:27

This xml code for style customizes my app's facebook login button like in the picture (in text and button size).

<com.facebook.login.widget.LoginButton
    android:id="@+id/login_button"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="40dip"
    android:paddingTop="10dp"
    android:paddingBottom="10dp"
    android:textSize="20sp"
    facebook:com_facebook_login_text="Facebook"
    facebook:com_facebook_logout_text="Facebook" />

Result: enter image description here

查看更多
登录 后发表回答