how to change layout elements according to user selection
<p>i have an activity which has an relative layout.</p>

<pre><code>&lt;RelativeLayout  xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="#FFFFFF"&gt;



 &lt;TextView android:id="@+id/time_label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text = "Name :"
        android:textSize = "14sp"
        android:textColor = "#000000"
        android:textStyle = "bold"
        android:layout_gravity="center_vertical|center_horizontal"
    /&gt;

   &lt;Spinner android:id="@+id/spinner_time"
        android:layout_height="40dp" 
        android:layout_width="match_parent" 
            android:prompt="@string/time_list" 
         android:layout_below = "@+id/time_label"
         android:layout_marginLeft = "5dp"
         android:layout_marginRight = "5dp"&gt;
   &lt;/Spinner&gt;

 &lt;TextView&gt;&lt;/TextView&gt; 
 &lt;EditText&gt;&lt;/EditText&gt;
 &lt;ImageButton&gt;&lt;/ImageButton&gt;

&lt;/RelativeLayout&gt;
</code></pre>

<p>Now according to user selection from spinner i need to change the layout elements like 2 buttons 3 textview or 4 buttons 1 textview. So for this do i have to take all the elements in the xml layout and use <strong>"android:visibility"</strong> optional to show according to user selection or there is any other better way to do this cause i am finding this method a bit cluttered.</p>

<p>Thanks</p>
