title: How does addView() of TableRow work?
body: <p>I tried</p>
  
  <pre><code> private void addSnapPictureRow(TableLayout table, Bitmap bitmap) {
          /*
           * 1st row = TextView (Check In)
           */
          TableRow row = new TableRow(this);  
          row.setGravity(Gravity.CENTER_HORIZONTAL);
          // add text
          TextView text = new TextView(this);
          text.setText("Snap Picture");
          TableRow.LayoutParams textLayoutParams = new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT);
          textLayoutParams.setMargins(100, 0, 0, 0);
          row.addView(text, textLayoutParams);
  
          // add picture
          ImageView picture = new ImageView(this);
          picture.setImageResource(R.drawable.adium);
          row.addView(picture);
  
          /*
           * 2nd row = View (separator)
           */
          TableRow separator = new TableRow(this);
          View line = new View(this);
          TableRow.LayoutParams separatorLayoutParams = new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, 1);
          separatorLayoutParams.setMargins(100, 0, 0, 0);
          line.setBackgroundColor(Color.BLUE);
          separator.addView(line, separatorLayoutParams);
  
          // add row to table
          table.addView(row);
          // add a separator
          table.addView(separator);
      }
  </code></pre>
  
  <p>But the picture never showed. If I change the gravity to <code>CENTER_HORIZONTAL</code>, then it shows only a small part of the picture.  </p>
  
  <p><img src="https://i.stack.imgur.com/PgC9P.png" alt="enter image description here"></p>
  
  <p>When create table with xml, I thought it automatically aligned horizontally. I can't understand how TableRow layout works. Could anyone shed me some lights on this?</p>