我有一个位于 a 下方的ScrollView按钮,该按钮设置为与父级底部对齐。滚动视图设置wrap_content为它的高度。一旦ScrollView填充了内容,它就会出现在按钮下方。如何将其设置为不在按钮后面,以便ScrollView在按钮开始时结束?
我试过放在android:layout_below底部按钮,当它不起作用时,我尝试layout_above在ScrollView按钮上方的 for 中。最后一个导致我的应用程序在启动时崩溃,不知道为什么。第一个一旦ScrollView比屏幕长,它会导致按钮被放置在下面而无法访问它。
这是我的 XML 文件。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/light_blue"
    android:padding="5dp"
    tools:context=".MainActivity" >
    <EditText
        android:id="@+id/editText_query"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="@string/queryPromt"
        android:imeOptions="actionNext"
        android:inputType="text"
        android:textColor="#000" />
    <EditText
        android:id="@+id/editText_tag"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/editText_query"
        android:layout_marginTop="10dp"
        android:layout_toLeftOf="@+id/saveButton"
        android:hint="@string/tagPrompt"
        android:imeOptions="actionDone"
        android:inputType="text" />
    <Button
        android:id="@id/saveButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_below="@id/editText_query"
        android:text="@string/save" />
    <TextView
        android:id="@+id/textView_taggedSearches"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignRight="@id/saveButton"
        android:layout_below="@id/saveButton"
        android:layout_marginTop="10dp"
        android:background="#666"
        android:gravity="center_horizontal"
        android:text="@string/taggedSearches"
        android:textColor="#FFF"
        android:textSize="18sp" />
    <ScrollView
        android:id="@+id/scrollView_query"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/textView_taggedSearches"
        android:padding="5dp" >
        <TableLayout
            android:id="@+id/tableLayout_query"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:padding="5dp"
            android:stretchColumns="*" >
        </TableLayout>
    </ScrollView>
    <Button
        android:id="@+id/button_clearTags"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:text="@string/clearTags" />
</RelativeLayout>