title: android Set Height of TableLayout
body: <p>I have a TableLayout with just a single row (i.e. the Header Row) in XML. Other all rows I add dynamically.
  XML PART :</p>
  
  <pre><code>    &lt;TableLayout android:id="@+id/list_table" 
      android:layout_width="match_parent" android:layout_height="wrap_content" 
      android:stretchColumns="1" android:background="#808000" **android:scrollbars="vertical"&gt;**
      &lt;TableRow android:layout_margin="1dp" android:layout_height="wrap_content" 
      android:layout_width="wrap_content" android:id="@+id/list_head_Row"&gt;
          &lt;TextView android:layout_width="wrap_content"  
          android:text="Col1" android:layout_height="wrap_content"&gt;&lt;/TextView&gt;
          &lt;TextView android:gravity="center" android:layout_width="wrap_content" android:text="Col2" android:layout_height="wrap_content"&gt;&lt;/TextView&gt;
          &lt;TextView android:layout_width="wrap_content" android:text="Col3"  android:layout_height="wrap_content"&gt;&lt;/TextView&gt;
      &lt;/TableRow&gt;
  &lt;/TableLayout&gt;
  </code></pre>
  
  <p>In Activity class, I add TableRows :</p>
  
  <pre><code>TableRow tr = new TableRow(this);
  tr.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));
  // Add 3 TextViews
  // Add Row to table
  t1.addView(tr, new TableLayout.LayoutParams(LayoutParams.FILL_PARENT,             LayoutParams.WRAP_CONTENT));
  </code></pre>
  
  <p>With this much all rows gets added to the table and fills the screen. I want to set is, view only 4-5 rows and others can be scrolled.For that I added :</p>
  
  <pre><code>    int tableHgt = t1.getChildAt(0).getHeight() + (rowHgt *40);
      t1.setLayoutParams(new TableLayout.LayoutParams(LayoutParams.FILL_PARENT, tableHgt));
  </code></pre>
  
  <p>With this I can't see any row at all except the header row added in xml. How can I make its height to see just 5 rows and othe all can be scrolled ? In <code>TableLayout</code> <code>android:scrollbars="vertical"</code> is also added.</p>
  
  <p>Where am I going wrong ?</p>
  
  <p>Any help is highly appreciated.</p>
  
  <p>Thanks</p>