我的XML看起来像这样
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"/>
和背景drawble XML是
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>
现在在Android的工作室preVIEW屏状态显示正常。
Now in android studio preview screen it shows as expected.
但是,当我在我的手机或模拟器中运行它,它显示通过Facebook登陆默认情况下,像这样
But when I run it on my phone or emulator, it shows "LOG IN WITH FACEBOOK" by default, like this
我如何上运行的应用程序我的自定义文本?
How do I get my custom text on running the application?
使用 Facebook的:login_text
和 Facebook的:logout_text
<com.facebook.widget.LoginButton
android:id="@+id/login_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
facebook:confirm_logout="false"
facebook:fetch_user_info="true"
android:text="testing 123"
facebook:login_text="LOGIN"
facebook:logout_text="LOGOUT"
/>
如果以上不工作,尝试添加在你的价值观的文件夹下面的
If the above doesnt work, try to add following in your values folder
<resources>
<string name="com_facebook_loginview_log_in_button">LOGIN</string>
<string name="com_facebook_loginview_log_out_button">LOGOUT</string>
</resources>
更新:可能的原因
https://github.com/facebook/facebook-android-sdk/blob/master/facebook/src/com/facebook/login/widget/LoginButton.java#L599
更新2:可能的解决方法
覆盖这些字符串在的strings.xml
<string name="com_facebook_loginview_log_out_button">Log out</string>
<string name="com_facebook_loginview_log_in_button">Log in</string>
<string name="com_facebook_loginview_log_in_button_long">Log in with Facebook</string>
其他字符串可以发现here
上一篇:如何使图像填充RelativeLayout的背景不拉伸图像、背景、RelativeLayout
下一篇:科尔多瓦5.0.0 Android应用程序无法连接到互联网使用的Android 4.0.0互联网、连接到、科尔、应用程序