I have a Layout dialog that has several views that are initialized as Gone Visibility. However, the space for each of the Views is still allocated, which leads to a very large gap between the two upper permanent views and the lower button.
Below is the Layout file I am using.
If anyone has 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>
source
share