我希望所有人都Buttons
自动具有相同的高度和宽度。然而,FacebookButton
不会对 做出反应android:layout_weight="1"
,并且正如我在代码设置中所做的那样padding
,它不会始终如一地工作。
<?xml version="1.0" encoding="utf-8"?>
<android.support.percent.PercentRelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/root_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:context="com.port.android.ui.ActivityMain">
<TextView
android:id="@+id/first"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:textAlignment="center"
app:layout_marginTopPercent="20%"
app:layout_widthPercent="70%"
app:layout_heightPercent="10%"
android:gravity="center"
android:text="Some text about login" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/buttons"
android:layout_below="@+id/first"
android:layout_above="@+id/second"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin">
<com.facebook.login.widget.LoginButton
android:id="@+id/login_with_facebook"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingBottom="15dp"
android:layout_weight="1"
android:text="@string/login_with_facebook" />
<Button
android:id="@+id/login_with_google"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/google_button_press"
android:text="@string/login_with_google" />
<Button
android:id="@+id/login_with_twitter"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/login_with_twitter" />
<Button
android:id="@+id/login_with_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/login_with_password" />
</LinearLayout>
<TextView
android:id="@+id/second"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
app:layout_widthPercent="70%"
app:layout_marginBottomPercent="5%"
app:layout_heightPercent="15%"
android:gravity="center"
android:text="Some more text about login" />
</android.support.percent.PercentRelativeLayout>