title: Center item in GridLayout
body: <p>I'm using a Gridlayout which is made in xml with a couple headers in the first line. Now I want to add new rows with items dynamical to the grid.
  My Problem is the items are not centered in the cell and doesn't match with the headers.</p>
  
  <p>This is the Grid in the xml</p>
  
  <pre><code>&lt;GridLayout
              android:id="@+id/newGrid"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:columnCount="5"
              android:rowCount="4"&gt;
              &lt;!-- Grid Header --&gt;
              &lt;Space
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_gravity="center" /&gt;
  
              &lt;TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_columnWeight="1"
                  android:layout_gravity="center"
                  android:text="@string/cellNo" /&gt;
  
              &lt;TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_columnWeight="1"
                  android:layout_gravity="center"
                  android:text="@string/desity" /&gt;
  
              &lt;TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_columnWeight="1"
                  android:layout_gravity="center"
                  android:text="@string/voltage" /&gt;
  
              &lt;android.support.v7.widget.AppCompatImageView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_gravity="center"
                  android:src="@drawable/problemIcon" /&gt;
  
  &lt;/GridLayout&gt;
  </code></pre>
  
  <p>This is for example how I try to add a TextView in the second row in the second cell.</p>
  
  <pre><code>    ...
      TextView cellnum = new TextView(getContext());
      cellnum.setGravity(Gravity.CENTER);
      cellnum.setText("9");
      ...
      gridLayout.addView(cellnum);
  </code></pre>
  
  <p>The text seems to be in the right cell but its not centered right under the headline</p>
  
  <p>This is the xml verison which i tried frist and worked perfect but I need to build it dynamicaly</p>
  
  <pre><code>               &lt;TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_gravity="center"
                  android:text="9" /&gt;
  </code></pre>