Views with Visibility Gone appear to be taking up space still
I have a dialog Layout that has several views that are initialised as Visibility Gone. However the space for each of the Views still appears to be being allocated resulting i开发者_StackOverflow中文版n a very large gap between the top two permanent views and the bottom Button.
Below is the Layout file I'm using.
If anyone has any ideas that would be great.
<?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>
精彩评论