title: LinearLayout Visibility Gone
body: <p>Alright, I'm running into a bizarre problem with my Android Layout. I have two LinearLayouts in my xml layout definition. What I want to do is hide them both at the start of the program, and then set the visibility of each of them dynamically at runtime, just showing one at a time.</p>
  
  <p>This is my xml layout:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:gravity="center_horizontal"
  android:orientation="vertical" &gt;
  &lt;LinearLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_gravity="center"
      android:layout_margin="2dip"
      android:background="@android:color/white"
      android:orientation="vertical"
      android:padding="2dip"
      android:paddingBottom="2dip" &gt;
      &lt;!-- Unimportant stuff --&gt;
    &lt;/LinearLayout&gt;    
  &lt;LinearLayout
      android:id="@+id/results1"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_margin="2dip"
      android:background="@android:color/white"
      android:orientation="vertical"
      android:visibility="gone" &gt;
      &lt;SegmentedRadioGroup
          android:id="@+id/segment_sort"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:checkedButton="@+id/button_one"
          android:orientation="horizontal" &gt;
          &lt;RadioButton
              android:id="@+id/button_one"
              android:layout_weight="1"
              android:button="@null"
              android:gravity="center"
              android:minHeight="33dip"
              android:text="@string/sort_first"
              android:textAppearance="?android:attr/textAppearanceSmall"
              android:textColor="@color/radio_colors" /&gt;
          &lt;RadioButton
              android:id="@+id/button_two"
              android:layout_weight="1"
              android:button="@null"
              android:gravity="center"
              android:minHeight="33dip"
              android:text="@string/sort_second"
              android:textAppearance="?android:attr/textAppearanceSmall"
              android:textColor="@color/radio_colors" /&gt;
          &lt;RadioButton
              android:id="@+id/button_three"
              android:layout_weight="1"
              android:button="@null"
              android:gravity="center"
              android:minHeight="33dip"
              android:text="@string/sort_third"
              android:textAppearance="?android:attr/textAppearanceSmall"
              android:textColor="@color/radio_colors" /&gt;
      &lt;/SegmentedRadioGroup&gt;
  
      &lt;ListView
          android:id="@+id/listview1"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content" /&gt;
  &lt;/LinearLayout&gt;
  
  &lt;LinearLayout
      android:id="@+id/results2"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_margin="2dip"
      android:background="@android:color/white"
      android:orientation="vertical"
      android:visibility="gone" &gt;
  
      &lt;SegmentedRadioGroup
          android:id="@+id/segment_sort2"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:checkedButton="@+id/button_one2"
          android:orientation="horizontal" &gt;
          &lt;RadioButton
              android:id="@+id/button_one2"
              android:layout_weight="1"
              android:button="@null"
              android:gravity="center"
              android:minHeight="33dip"
              android:text="@string/sort_first"
              android:textAppearance="?android:attr/textAppearanceSmall"
              android:textColor="@color/radio_colors" /&gt;
          &lt;RadioButton
              android:id="@+id/button_two2"
              android:layout_weight="1"
              android:button="@null"
              android:gravity="center"
              android:minHeight="33dip"
              android:text="@string/sort_second"
              android:textAppearance="?android:attr/textAppearanceSmall"
              android:textColor="@color/radio_colors" /&gt;
          &lt;RadioButton
              android:id="@+id/button_three2"
              android:layout_weight="1"
              android:button="@null"
              android:gravity="center"
              android:minHeight="33dip"
              android:text="@string/sort_third"
              android:textAppearance="?android:attr/textAppearanceSmall"
              android:textColor="@color/radio_colors" /&gt;
      &lt;/SegmentedRadioGroup&gt;
       &lt;ListView
          android:id="@+id/listview2"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:layout_above="@+id/btBottom" /&gt;
     &lt;/LinearLayout&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Now, the problem that I'm having is that even though both visibilities are set to "gone",
  the second LinearLayout, results2, is always shown at program start. Showing and hiding dynamically works fine.</p>
  
  <p>Thanks!</p>