Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set Login/Logout Text for Button in Facebook Android SDK 4.0?

Tags:

My xml looks like this

<com.facebook.login.widget.LoginButton xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/fb_login_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:paddingLeft="15dp" android:paddingRight="15dp" android:text="CONNECT WITH FACEBOOK" android:textColor="@color/white" android:textSize="20sp" android:textStyle="bold" android:background="@drawable/button_fb_login"/> 

and background drawble xml is

<selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true">     <shape>         <solid android:color="#4e69a2" />         <stroke android:width="3dip" android:color="#4e69a2" />         <padding android:bottom="0dip" android:left="0dip" android:right="0dip" android:top="0dip" />     </shape> </item>  <item>     <shape>         <solid android:color="#3b5998" />         <stroke android:width="3dip" android:color="#3b5998" />         <padding android:bottom="0dip" android:left="0dip" android:right="0dip" android:top="0dip" />     </shape> </item> 

Now in android studio preview screen it shows as expected.

enter image description here

But when I run it on my phone or emulator, it shows "LOG IN WITH FACEBOOK" by default, like this

enter image description here

How do I get my custom text on running the application?

like image 717
Devanshu Dwivedi Avatar asked Apr 20 '15 06:04

Devanshu Dwivedi


1 Answers

Just need change the attribute accordingly. Refer to : this

eg:

<com.facebook.login.widget.LoginButton         xmlns:facebook="http://schemas.android.com/apk/res-auto"         facebook:com_facebook_login_text="LOGIN"/> 
like image 53
Mark KWH Avatar answered Oct 06 '22 00:10

Mark KWH