在Facebook的Andr​​oid SDK中3.5自定义Facebook登录按钮图像 [英] Custom Facebook login button image in Facebook Android SDK 3.5

查看:411
本文介绍了在Facebook的Andr​​oid SDK中3.5自定义Facebook登录按钮图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个类似的静脉<一个href="http://stackoverflow.com/questions/16496738/is-it-possible-to-change-facebook-login-button-image-in-facebook-android-sdk3">this queston 适用于以下至Facebook的Andr​​oid SDK 3.0 ...

In a similar vein to this queston related to Facebook Android SDK 3.0 ...

是否有可能使用自己的形象在SDK 3.5 Facebook的登录按钮,无需定制的SDK本身?

Is it possible to use my own image for the Facebook login button in SDK 3.5, without customising the SDK itself?

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

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

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

我看到两个图像与新SDK。我的图像(R.drawable.facebook)是一家大型的灰色背景与白色的F。但是,我也看到了小白色的背景和透明的F由叠加在背景之上的原Facebook的按钮图标的到来。请参见 Facebook的文档相关的SDK 3.5日志按钮。我想彻底删除原来的Facebook图标。

I am seeing two images with the new SDK. My image (R.drawable.facebook) is a large grey background with a white "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. See the facebook docs related to the SDK 3.5 log in button. I want to remove the original facebook icon completely.

推荐答案

除了设置背景资源,也呼吁:

In addition to setting the background resource, also call:

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

这篇关于在Facebook的Andr​​oid SDK中3.5自定义Facebook登录按钮图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆