Hide a EditText & make it visible by clicking a menu
<p>I have a layout having the contact deatils of the phone. When i click the option menu i need make an edittext visible in that screen. I have done it. But there  is problem facing that the edit text height is occupied in the screen when its made invisible. How can i remove the space occupied by edit text, while its invisible in the screen(layout).. My code is given below</p>

<p>My xml is: </p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
 &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:paddingLeft="10dp"
android:paddingRight="10dp"&gt;

    &lt;ListView android:id="@id/android:list" android:layout_width="fill_parent"
    android:layout_height="fill_parent" android:layout_weight="1"
    android:drawSelectorOnTop="false"&gt;
&lt;/ListView&gt;

&lt;TextView android:id="@id/android:empty" android:layout_width="fill_parent"
    android:layout_height="fill_parent" android:text="No Entries available"&gt;
&lt;/TextView&gt;




&lt;TableRow android:id="@+id/TableRow001"
android:layout_width="wrap_content" android:background="#C0C0C0"
 android:layout_height="wrap_content"&gt;

        &lt;EditText android:id="@+id/NumberEditText01"                 

               android:layout_width="wrap_content"
    android:paddingLeft="20dip" 
    android:layout_height="wrap_content"&gt;
&lt;/EditText&gt;

&lt;Button android:layout_width="wrap_content" android:id="@+id/callNow01"
    android:layout_height="wrap_content"
   android:text="Call now"
&gt;
&lt;/Button&gt;

&lt;/TableRow&gt;
      &lt;/LinearLayout&gt;
</code></pre>

<p>Class : Listcontacts</p>

<pre><code>    public class ListContacts extends ListActivity {

          TableRow tableRow;
          EditText phoneNumber;
          Button callNow;

            public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

// Associate the xml with the activity
setContentView(R.layout.activitylist);
     tableRow =  (TableRow) findViewById(R.id.TableRow001);
tableRow.setVisibility(View.INVISIBLE);


phoneNumber = (EditText) findViewById(R.id.NumberEditText01);
phoneNumber.setVisibility(View.INVISIBLE);
phoneNumber.setKeyListener(DialerKeyListener.getInstance());

callNow = (Button) findViewById(R.id.callNow01);
callNow.setVisibility(View.INVISIBLE);
   }


 @Override
   public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {

case FIRST:
     tableRow.setVisibility(View.VISIBLE);
     phoneNumber.setVisibility(View.VISIBLE);
    callNow.setVisibility(View.VISIBLE);
    break;
}
}
}
</code></pre>
