title: Dynamically added rows to TableLayout not showing up
body: <p>I'm trying to add rows to TableLayout at runtime but the data is simply not showing up.</p>
  
  <p>XML:</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"
      android:weightSum="1" &gt;
  
      &lt;ScrollView
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:scrollbarSize="10dp"
          android:scrollbars="horizontal|vertical" &gt;
  
          &lt;TableLayout
              android:id="@+id/server_dataTable"
              android:layout_width="match_parent"
              android:layout_height="300dp"
              android:background="@color/color_data_table_header_background"
              android:stretchColumns="*" &gt;
          &lt;/TableLayout&gt;
      &lt;/ScrollView&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>The relevant code:</p>
  
  <pre><code>private TableLayout addRowToTable(TableLayout table, String[] data) {
      Context context = this.getApplicationContext();
      TableRow row = new TableRow(context);
  
      TableLayout.LayoutParams rowParams = new TableLayout.LayoutParams();
      // Wrap-up the content of the row
      rowParams.height = TableLayout.LayoutParams.WRAP_CONTENT;
      rowParams.width = TableLayout.LayoutParams.WRAP_CONTENT;
  
      for (int i = 0; i &lt; data.length; i++) {
          TableRow.LayoutParams columnParams = new TableRow.LayoutParams();
          // wrap-up content of the row
          columnParams.height = TableRow.LayoutParams.WRAP_CONTENT;
          columnParams.width = TableRow.LayoutParams.WRAP_CONTENT;
          // set gravity to center of the column
          columnParams.gravity = Gravity.CENTER;
          TextView column = new TextView(context);
          column.setText(data[i]);
          row.addView(column, columnParams);
      }
  
      table.addView(row, rowParams);
  
      return table;
  }
  </code></pre>
  
  <p>I'm calling <code>addRowToTable</code> from my activity's onCreate():</p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_server);
      // Show the Up button in the action bar.
      setupActionBar();
  
      TableLayout dataTableHeader = (TableLayout) findViewById(R.id.server_dataTable);
      dataTableHeader = addRowToTable(dataTableHeader, headerLabels);
  }
  </code></pre>
  
  <p>I've been at this for about 40 minutes now and have already read almost all related questions on StackOverflow but haven't found anything helpful. Any help/pointers would be great!</p>
  
  <p>Edit: Added the activity's onCreate().</p>