title: Dynamic creation of tablelayout android
body: <p>I want to add rows to a tablelayout dynamically. This is my code.</p>
  
  <pre><code> TableRow tableRow = null;
   TextView textView = null;
   ImageView imageView = null;
   TableLayout tableLayout = (TableLayout)findViewById(R.id.tableLayout);
   RelativeLayout relativeLayout = null;
           for (String string: listOfStrings) {
                              tableRow = new TableRow(this);
                              relativeLayout = (RelativeLayout) View.inflate(this,
                                      R.layout.row, null);
                              textView = (TextView) relativeLayout.getChildAt(0);
                              textView.setText(string);
                              imageView= (ImageView) relativeLayout.getChildAt(1);
                              imageView.setBackgroundColor(R.color.blue);
                              tableRow.addView(relativeLayout);
                              tableLayout.addView(tableRow);
                          }
  </code></pre>
  
  <p>I have created a row layout with width fill_parent, with textView on left most side and an imageView on right most side. However when I run this program the row width appears wrap_content instead of fill_parent with image overlapping text. Please help. Thanks</p>