我正在做一个XML登录到一个应用程序,并在两个TextView的电子邮件和密码后,我想并排两个按钮登录:一使用在TextViews和其他数据使用Facebook登录Android,类似于默认的Facebook按钮样式的正常按钮
这是它的外观:
但是,如果你仔细看,Facebook的按钮比另一个高。字体大小和字体系列也匹配。
这是到目前为止我的代码,有水平的LinearLayout内的两个按钮:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center_horizontal">
<Button android:id="@+id/email_sign_in_button"
style="android:textAppearanceSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/action_sign_in"
android:textStyle="bold" />
<com.facebook.login.widget.LoginButton
android:id="@+id/login_button_fb"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/com_facebook_loginview_log_in_button_long"
android:paddingTop="10dp"
android:paddingBottom="10dp" />
</LinearLayout>
编辑:
我加解析平台,这个应用程序,它有一个自定义的方法用Facebook的用户登录。
ParseFacebookUtils.logInWithReadPermissionsInBackground(this, permissions, new LogInCallback() {
@Override
public void done(ParseUser user, ParseException err) {
if (user == null) {
Log.d("MyApp", "Uh oh. The user cancelled the Facebook login.");
} else if (user.isNew()) {
Log.d("MyApp", "User signed up and logged in through Facebook!");
} else {
Log.d("MyApp", "User logged in through Facebook!");
}
}
});
此方法应该被称为当用户按Facebook的按钮,我不能把它放在点击监听器com.facebook.login.widget.LoginButton。
该解决方案是我自己定制的按钮,但它看起来不像com.facebook.login.widget.LoginButton。现在
所以我的问题是如何风格我自己的按钮,看起来像Facebook的一个而是使用自定义的宽度,高度,字体...
可以,但我认为这保持默认按钮的外观并仅调整大小非常重要。保持与使用该按钮的其他应用程序的一致性。 – jorgeavilae
现在我改变了这个问题,我将使用我自己的按钮,但如何使这个按钮继承FacebookButton的风格。 – jorgeavilae
我想我已经得到了你正在寻找的答案。检查我最后的编辑。 – DH28