title: Center checkbox programmatically?
body: <p>I'm got a stretched table and I want my checkbox to appear central also within the table row. On the textView I've called:</p>
  
  <pre><code>            myTextView.setGravity(Gravity.CENTER);
  </code></pre>
  
  <p>And I've also tried setting it as a table parameter:</p>
  
  <p>This is my XML that sets up the table:</p>
  
  <pre><code>&lt;TableLayout
      android:id="@+id/info"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:layout_alignParentLeft="true"
      android:layout_below="@+id/linearLayout1"
      android:layout_margin="6dp"
      android:stretchColumns="0,1,2,3,4" &gt;
  
      &lt;TableRow
          android:id="@+id/tableRow1"
          android:layout_width="wrap_content"
          android:layout_height="fill_parent"
          android:background="@drawable/roundedheader" &gt;
  </code></pre>
  
  <p>And this is the code I'm calling as I create each row:</p>
  
  <pre><code>    //set table margin
      TableLayout.LayoutParams tableRowParams= new TableLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
  
      int leftMargin=0,rightMargin=0,bottomMargin=0;
      int topMargin=5;
  
      tableRowParams.setMargins(leftMargin, topMargin, rightMargin, bottomMargin);
      tableRowParams.gravity = Gravity.CENTER;
      row.setLayoutParams(tableRowParams);
  
      // add the TableRow to the TableLayout
      table.addView(row);
  </code></pre>
  
  <p>However the same command doesn't have the desired effect on the checkbox. Does any know what the difference is and what I need to do. The checkbox isn't within any other layout its just in the table row. </p>