【发布时间】:2015-06-11 06:42:11
【问题描述】:
我正在尝试自定义 Facebook SDK 4.0 (Android) 中的登录按钮,但没有办法...我正在查看 Fb Docs 但没有结果。请问有什么办法吗?
提前致谢!
【问题讨论】:
标签: android facebook button styling
我正在尝试自定义 Facebook SDK 4.0 (Android) 中的登录按钮,但没有办法...我正在查看 Fb Docs 但没有结果。请问有什么办法吗?
提前致谢!
【问题讨论】:
标签: android facebook button styling
你的按钮
<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);
【讨论】:
对于新的 Facebook SDK (4+),您可以使用此代码自定义您的按钮文本
<com.facebook.login.widget.LoginButton
xmlns:facebook="http://schemas.android.com/apk/res-auto"
facebook:com_facebook_login_text="Custom Login text"
...
/>
【讨论】: