Android 可见性消失的视图似乎仍在占用空间

Android 可见性消失的视图似乎仍在占用空间,android,android-layout,Android,Android Layout,我有一个对话框布局,它有几个视图,这些视图被初始化为可见性消失。但是,每个视图的空间似乎仍在分配中,导致顶部两个永久视图和底部按钮之间存在很大的间隙 下面是我正在使用的布局文件 如果有人有任何想法那就太好了 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_widt

我有一个对话框布局,它有几个视图,这些视图被初始化为可见性消失。但是,每个视图的空间似乎仍在分配中,导致顶部两个永久视图和底部按钮之间存在很大的间隙

下面是我正在使用的布局文件

如果有人有任何想法那就太好了

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content">
  <Spinner 
    android:id="@+id/SearchTypeSpinner" 
    android:layout_height="wrap_content" 
    android:layout_width="fill_parent"
    android:prompt="@string/SearchPrompt"
    android:entries="@array/SearchTypes">
    </Spinner>
  <EditText
    android:id="@+id/SearchText"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/SearchTypeSpinner"
    android:imeOptions="actionDone">
    </EditText>
  <TextView
    android:id="@+id/RadiusLabel"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="Search Radius"
    android:layout_below="@+id/SearchText"
    android:visibility="gone"
    style="@style/headerText">
    </TextView>
  <EditText
    android:id="@+id/RadiusText"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/RadiusLabel"
    android:visibility="gone"
    android:imeOptions="actionDone">
    </EditText>
  <Spinner
    android:id="@+id/StateSpinner"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/RadiusText"
    android:entries="@array/states"
    android:prompt="@string/StatePrompt"
    android:visibility="gone">
    </Spinner>
     <Button
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:id="@+id/ShowResultsButton"
    android:text="Show Results"
    android:layout_alignBottom="true">
    </Button>
</RelativeLayout>


您想要的结果是什么?顺便说一句,如果你想使用布尔值,它是android:layou\u alignParentBottom。否则,您需要提供一个资源id。我想做的是根据在顶部微调器中选择的选项,以这样的方式使某些视图可见,即在可见视图和底部按钮之间没有明显的间隙