Android 屏幕底部未设置带有ScrollView和Button的RelativeLayout

Android 屏幕底部未设置带有ScrollView和Button的RelativeLayout,android,scrollview,android-relativelayout,Android,Scrollview,Android Relativelayout,我希望我的编辑按钮始终显示在屏幕底部。下面是我的代码 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:padding

我希望我的编辑按钮始终显示在屏幕底部。下面是我的代码

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="@dimen/dimen_16dp">
    <Button
        android:id="@+id/button_edit"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentEnd="true"
        android:background="@color/colorPrimaryDark"
        android:text="@string/edit"
        android:textSize="20sp" />

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fillViewport="true"
        android:layout_above="@+id/button_edit">
        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            <android.support.design.widget.TextInputLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:id="@+id/til_name_view"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="8dp"
                android:layout_marginTop="16dp"
                android:background="@drawable/register_layout_background"
                android:clickable="false"
                android:paddingBottom="16dp"
                android:paddingTop="16dp">

                <EditText
                    android:id="@+id/et_name_view"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="16dp"
                    android:layout_marginStart="16dp"
                    android:background="@color/transparent_color"
                    android:clickable="false"
                    android:gravity="center_vertical"
                    android:hint="@string/name"
                    android:inputType="textCapWords"
                    android:paddingTop="4dp" />
            </android.support.design.widget.TextInputLayout>

            <android.support.design.widget.TextInputLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:id="@+id/til_dob_view"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/til_name_view"
                android:layout_marginBottom="8dp"
                android:background="@drawable/register_layout_background"
                android:clickable="false"
                android:focusable="false"
                android:paddingBottom="16dp"
                android:paddingTop="16dp">

                <EditText
                    android:id="@+id/et_dob_view"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="16dp"
                    android:layout_marginStart="16dp"
                    android:background="@color/transparent_color"
                    android:clickable="false"
                    android:focusable="false"
                    android:gravity="center_vertical"
                    android:hint="@string/date_of_birth"
                    android:inputType="date"
                    android:maxLength="10"
                    android:paddingTop="4dp" />
            </android.support.design.widget.TextInputLayout>

            <android.support.design.widget.TextInputLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:id="@+id/til_gender"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/til_dob_view"
                android:layout_marginBottom="8dp"
                android:background="@drawable/register_layout_background"
                android:clickable="false"
                android:focusable="false"
                android:paddingBottom="16dp"
                android:paddingTop="16dp">

                <EditText
                    android:id="@+id/et_gender_view"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="16dp"
                    android:layout_marginStart="16dp"
                    android:background="@color/transparent_color"
                    android:clickable="false"
                    android:focusable="false"
                    android:gravity="center_vertical"
                    android:hint="@string/gender"
                    android:inputType="date"
                    android:maxLength="10"
                    android:paddingTop="4dp" />
            </android.support.design.widget.TextInputLayout>

            <android.support.design.widget.TextInputLayout
                android:id="@+id/til_address_view"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/til_gender"
                android:layout_marginBottom="8dp"
                android:background="@drawable/register_layout_background"
                android:clickable="false"
                android:paddingBottom="16dp"
                android:paddingTop="16dp">

                <EditText
                    android:id="@+id/et_address_view"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="16dp"
                    android:layout_marginStart="16dp"
                    android:background="@color/transparent_color"
                    android:clickable="false"
                    android:gravity="clip_vertical"
                    android:hint="@string/house_no_sector_street_phase_floor_etc"
                    android:inputType="textCapSentences"
                    android:paddingTop="4dp" />
            </android.support.design.widget.TextInputLayout>

            <android.support.design.widget.TextInputLayout
                android:id="@+id/til_pin_view"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/til_address_view"
                android:layout_marginBottom="8dp"
                android:background="@drawable/register_layout_background"
                android:clickable="false"
                android:paddingBottom="16dp"
                android:paddingTop="16dp">

                <EditText
                    android:id="@+id/et_pin_view"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="16dp"
                    android:layout_marginStart="16dp"
                    android:background="@color/transparent_color"
                    android:clickable="false"
                    android:gravity="center_vertical"
                    android:hint="@string/pin_code"
                    android:inputType="number"
                    android:maxLength="6"
                    android:paddingTop="4dp" />
            </android.support.design.widget.TextInputLayout>

            <android.support.design.widget.TextInputLayout
                android:id="@+id/til_state_view"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/til_pin_view"
                android:layout_marginBottom="8dp"
                android:background="@drawable/register_layout_background"
                android:clickable="false"
                android:paddingBottom="16dp"
                android:paddingTop="16dp">

                <EditText
                    android:id="@+id/et_state_view"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="16dp"
                    android:layout_marginStart="16dp"
                    android:background="@color/transparent_color"
                    android:clickable="false"
                    android:gravity="center_vertical"
                    android:hint="@string/state"
                    android:inputType="textCapWords"
                    android:paddingTop="4dp" />
            </android.support.design.widget.TextInputLayout>

            <android.support.design.widget.TextInputLayout
                android:id="@+id/til_contact_view"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/til_state_view"
                android:layout_marginBottom="8dp"
                android:background="@drawable/register_layout_background"
                android:clickable="false"
                android:paddingBottom="16dp"
                android:paddingTop="16dp">

                <EditText
                    android:id="@+id/et_contact_view"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="16dp"
                    android:layout_marginStart="16dp"
                    android:background="@color/transparent_color"
                    android:clickable="false"
                    android:gravity="center_vertical"
                    android:hint="@string/mobile_no"
                    android:inputType="number"
                    android:maxLength="10"
                    android:paddingTop="4dp" />
            </android.support.design.widget.TextInputLayout>

            <android.support.design.widget.TextInputLayout
                android:id="@+id/til_email_view"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/til_contact_view"
                android:layout_marginBottom="8dp"
                android:background="@drawable/register_layout_background"
                android:clickable="false"
                android:paddingBottom="16dp"
                android:paddingTop="16dp">

                <EditText
                    android:id="@+id/et_email_view"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="16dp"
                    android:layout_marginStart="16dp"
                    android:background="@color/transparent_color"
                    android:clickable="false"
                    android:focusable="false"
                    android:gravity="center_vertical"
                    android:hint="@string/e_mail"
                    android:inputType="textEmailAddress"
                    android:paddingTop="4dp" />
            </android.support.design.widget.TextInputLayout>
        </RelativeLayout>
    </ScrollView>

</RelativeLayout>

问题:问题在于按钮没有显示在底部,而是显示在屏幕顶部,并且ScrollView根本不可见。如果我将外部RelativeLayout的android:layout\u height=“match\u parent”中的match\u parent更改为某个值,如500dp,则其工作正常,但只要我将其更改为match\u parent,按钮就会显示在顶部。
有人能帮我找到需要纠正的地方吗?谢谢

我已将框架布局放在scrollView中。在fragment的布局中,我试图再次使用scrollView,因此,我面临着这个问题。我通过删除framelayout的滚动视图解决了这个问题