Facebook Android SDK 3.5中的自定义Facebook登录按钮图像

Jon*_*n G 17 android facebook-android-sdk

与Facebook Android SDK 3.0相关的问题类似于...

是否可以在SDK 3.5中使用我自己的图像作为Facebook登录按钮,而无需自定义SDK本身?

使用链接问题中给出的答案:

<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="" />
Run Code Online (Sandbox Code Playgroud)

和:

final LoginButton button = (LoginButton) findViewById(R.id.login_button);
button.setBackgroundResource(R.drawable.facebook);
Run Code Online (Sandbox Code Playgroud)

我看到两个带有新SDK的图像.我的图像(R.drawable.facebook)是一个带有白色"f"的大灰色背景.但是,我也看到小白色背景和透明的"f"来自覆盖在背景顶部的原始facebook按钮图标.查看与SDK 3.5登录按钮相关的facebook文档.我想完全删除原来的facebook图标.

Min*_* Li 30

除了设置后台资源外,还可以调用:

button.setCompoundDrawablesWithIntrinsicBounds(0,0,0,0);
Run Code Online (Sandbox Code Playgroud)