LoginButton facebook android settext ();
-
20-12-2019 - |
Question
I have a problem while I try to set my text into com.facebook.widget.LoginButton
nothing happened.
This is my layout:
<com.facebook.widget.LoginButton
xmlns:facebook="http://schemas.android.com/apk/res-auto"
android:id="@+id/btn_profile_facebook"
android:layout_width="fill_parent"
android:layout_height="@dimen/profile_edittext_without_bg_height"
android:hint="@string/profile_facebook"
facebook:confirm_logout="false"
facebook:fetch_user_info="true"
facebook:login_text=""
facebook:logout_text=""
style="@style/TextViewFacebook"
/>
this is my style
<style name="TextViewFacebook" parent="@style/com_facebook_loginview_default_style">
<item name="android:textSize">@dimen/session_list_item_text_size_small</item>
<item name="android:textColor">@color/primary_text_color</item>
<item name="android:background">@null</item>-->
<item name="android:singleLine">true</item>
<item name="android:gravity">left|center_vertical</item>
<item name="android:textStyle">normal</item>
<item name="android:padding">0dp</item>
</style>
So when I try to do setText()
nothing happened (in text I am going to set user name).
Solution
Looking at the source of facebook sdk you can see that the text will be overwritten with a string from the ressources of facebook sdk:
https://github.com/facebook/facebook-android-sdk/blob/master/facebook/src/com/facebook/widget/LoginButton.java
Search for the Method setButtonText()
.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow