2015-04-06 110 views

回答

5

您的按钮

<com.facebook.widget.LoginButton 
    xmlns:fb="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/login_button" 
    android:layout_width="249dp" 
    android:layout_height="45dp" 
    android:layout_above="@+id/textView1" 
    android:layout_centerHorizontal="true" 
    android:layout_gravity="center_horizontal" 
    android:layout_marginBottom="30dp" 
    android:layout_marginTop="30dp" 
    android:contentDescription="@string/login_desc" 
    android:scaleType="centerInside" 
    fb:login_text="" 
    fb:logout_text="" /> 

,并在活动

LoginButton authbutton = (LoginButton) findViewById(R.id.login_button); 
authbutton.setBackgroundResource(R.drawable.facebook); 
authButton.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0,0); 
+1

在新的API com.facebook.widget.LoginButton似乎被com.facebook.login.widget.LoginButton取代 – giozh