title: How to hide all elements in a Layout in Android at once?
body: <p>I'm developing an Android app in eclipse.</p>
  
  <p>I have an XML which has 2 linear layouts next to each other. The left one has several buttons, which make content visible in the right. However, I would not only like these buttons to make specific content visible, but hide (setVisibility.GONE) all the other stuff in that layout. I have already tried removeAllViews, but this is not suitable for me since it deletes them. So my idea is to hide (set the visibility to gone) every single stuff, then make the ones I wish visible. The reason I ask this is that it takes too much time setting the visibility to gone for everything (24, actually) for all the 12 buttons.</p>
  
  <p>Thanks in advance</p>
  
  <p>Layout code:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/alap"
      android:layout_width="match_parent"
      android:layout_height="match_parent" &gt;
  
      &lt;ScrollView
          android:id="@+id/scrollView2"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_above="@+id/imageView3"
          android:layout_alignParentLeft="true"
          android:layout_below="@+id/imageView4" &gt;
  
          &lt;LinearLayout
              android:layout_width="197dp"
              android:layout_height="match_parent"
              android:orientation="vertical" &gt;
  
              &lt;ImageView
                  android:id="@+id/imageView2"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:src="@drawable/lewis" /&gt;
  
              &lt;Button
                  android:id="@+id/first"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:text="@string/first" /&gt;
  
              &lt;Button
                  android:id="@+id/second"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:text="@string/second" /&gt;
  
          &lt;/LinearLayout&gt;
      &lt;/ScrollView&gt;
  
      &lt;ImageView
          android:id="@+id/imageView3"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentBottom="true"
          android:layout_alignParentLeft="true"
          android:scaleType="center"
          android:src="@drawable/cpr1" /&gt;
  
      &lt;ImageView
          android:id="@+id/imageView4"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentLeft="true"
          android:layout_alignParentRight="true"
          android:layout_alignParentTop="true"
          android:scaleType="center"
          android:src="@drawable/epizodok" /&gt;
  
      &lt;LinearLayout
          android:id="@+id/def"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_above="@+id/imageView3"
          android:layout_alignParentRight="true"
          android:layout_alignTop="@+id/scrollView2"
          android:layout_toRightOf="@+id/scrollView2"
          android:orientation="vertical"
          android:visibility="visible" &gt;
  
          &lt;ImageView
              android:id="@+id/image1"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:src="@drawable/lewis"
              android:visibility="gone" /&gt;
  
          &lt;ImageView
              android:id="@+id/image2"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:src="@drawable/ic_launcher"
              android:visibility="gone" /&gt;
  
      &lt;/LinearLayout&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>