简体   繁体   English

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

[英]Custom Facebook login button image in Facebook Android SDK 3.5

In a similar vein to this queston related to Facebook Android SDK 3.0 ... 与Facebook Android SDK 3.0相关的问题类似于...

Is it possible to use my own image for the Facebook login button in SDK 3.5, without customising the SDK itself? 是否可以在SDK 3.5中使用我自己的图像作为Facebook登录按钮,而无需自定义SDK本身?

Using the answer given in the linked question: 使用链接问题中给出的答案:

<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="" />

and: 和:

final LoginButton button = (LoginButton) findViewById(R.id.login_button);
button.setBackgroundResource(R.drawable.facebook);

I am seeing two images with the new SDK. 我看到两个带有新SDK的图像。 My image (R.drawable.facebook) is a large grey background with a white "f". 我的图像(R.drawable.facebook)是一个带有白色“f”的大灰色背景。 However, I am also seeing the small white background and transparent "f" coming from the original facebook button icon overlayed on top of the background. 但是,我也看到小白色背景和透明的“f”来自覆盖在背景顶部的原始facebook按钮图标。 See the facebook docs related to the SDK 3.5 log in button. 查看与SDK 3.5登录按钮相关的facebook文档 I want to remove the original facebook icon completely. 我想完全删除原来的facebook图标。

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

button.setCompoundDrawablesWithIntrinsicBounds(0,0,0,0);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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