我正在做一個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