title: How to create a 6x3 grid layout?
body: <p>I would like to create a basic table with 6 rows and 3 columns. The rows represent the days and columns represent morning/evening. The layout I desire to create:</p>
  
  <p><a href="https://i.stack.imgur.com/0LeUS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0LeUS.png" alt="enter image description here"></a></p>
  
  <p>I want to be able to color the nodes (red and green for availability). Also each row is stanched on the whole width of the screen. I have created something similar with <code>TableLayout</code>:</p>
  
  <pre><code>&lt;TableLayout
      android:id="@+id/shifts_table"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:shrinkColumns="*"
      android:stretchColumns="*"
      android:layout_marginBottom="10dp"&gt;
  
      &lt;TableRow
          android:id="@+id/table_row_sunday"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"&gt;
  
          &lt;TextView
              android:id="@+id/text_sunday"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="@string/form_sunday"/&gt;
  
          &lt;LinearLayout
              android:id="@+id/layout_sunday_morning"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"&gt;
  
              &lt;CheckBox
                  android:id="@+id/checkbox_sunday_morning"
                  android:layout_height="wrap_content"
                  android:drawSelectorOnTop="true"
                  android:clickable="false"
                  android:layout_width="wrap_content" /&gt;
  
              &lt;TextView
                  android:id="@+id/text_sunday_morning"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text="@string/form_morning"/&gt;
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:id="@+id/layout_sunday_evening"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"&gt;
  
              &lt;CheckBox
                  android:id="@+id/checkbox_sunday_evening"
                  android:layout_height="wrap_content"
                  android:drawSelectorOnTop="true"
                  android:clickable="false"
                  android:layout_width="wrap_content" /&gt;
  
              &lt;TextView
                  android:id="@+id/text_sunday_evening"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text="@string/form_evening"/&gt;
          &lt;/LinearLayout&gt;
      &lt;/TableRow&gt;
  
      &lt;TableRow
          android:id="@+id/table_row_monday"
          android:layout_height="wrap_content"
          android:layout_width="match_parent"&gt;
  
          &lt;TextView
              android:id="@+id/text_monday"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="@string/form_monday" /&gt;
  
          &lt;LinearLayout
              android:id="@+id/layout_monday_morning"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"&gt;
  
              &lt;CheckBox
                  android:id="@+id/checkbox_monday_morning"
                  android:layout_height="wrap_content"
                  android:drawSelectorOnTop="true"
                  android:clickable="false"
                  android:layout_width="wrap_content" /&gt;
  
              &lt;TextView
                  android:id="@+id/text_monday_morning"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text="@string/form_morning"/&gt;
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:id="@+id/layout_monday_evening"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"&gt;
  
              &lt;CheckBox
                  android:id="@+id/checkbox_monday_evening"
                  android:layout_height="wrap_content"
                  android:drawSelectorOnTop="true"
                  android:clickable="false"
                  android:layout_width="wrap_content" /&gt;
  
              &lt;TextView
                  android:id="@+id/text_monday_evening"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text="@string/form_evening"/&gt;
          &lt;/LinearLayout&gt;
      &lt;/TableRow&gt;
  
      &lt;TableRow
          android:id="@+id/table_row_tuesday"
          android:layout_height="wrap_content"
          android:layout_width="match_parent"&gt;
  
          &lt;TextView
              android:id="@+id/text_tuesday"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="@string/form_tuesday"/&gt;
  
          &lt;LinearLayout
              android:id="@+id/layout_tuesday_morning"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"&gt;
  
              &lt;CheckBox
                  android:id="@+id/checkbox_tuesday_morning"
                  android:layout_height="wrap_content"
                  android:drawSelectorOnTop="true"
                  android:clickable="false"
                  android:layout_width="wrap_content" /&gt;
  
              &lt;TextView
                  android:id="@+id/text_tuesday_morning"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text="@string/form_morning"/&gt;
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:id="@+id/layout_tuesday_evening"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"&gt;
  
              &lt;CheckBox
                  android:id="@+id/checkbox_tuesday_evening"
                  android:layout_height="wrap_content"
                  android:drawSelectorOnTop="true"
                  android:clickable="false"
                  android:layout_width="wrap_content" /&gt;
  
              &lt;TextView
                  android:id="@+id/text_tuesday_evening"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text="@string/form_evening"/&gt;
          &lt;/LinearLayout&gt;
      &lt;/TableRow&gt;
  
      &lt;TableRow
          android:id="@+id/table_row_wednesday"
          android:layout_height="wrap_content"
          android:layout_width="match_parent"&gt;
  
          &lt;TextView
              android:id="@+id/text_wednesday"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="@string/form_wednesday"/&gt;
  
          &lt;LinearLayout
              android:id="@+id/layout_wednesday_morning"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"&gt;
  
              &lt;CheckBox
                  android:id="@+id/checkbox_wednesday_morning"
                  android:layout_height="wrap_content"
                  android:drawSelectorOnTop="true"
                  android:clickable="false"
                  android:layout_width="wrap_content" /&gt;
  
              &lt;TextView
                  android:id="@+id/text_wednesday_morning"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text="@string/form_morning"/&gt;
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:id="@+id/layout_wednesday_evening"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"&gt;
  
              &lt;CheckBox
                  android:id="@+id/checkbox_wednesday_evening"
                  android:layout_height="wrap_content"
                  android:drawSelectorOnTop="true"
                  android:clickable="false"
                  android:layout_width="wrap_content" /&gt;
  
              &lt;TextView
                  android:id="@+id/text_wednesday_evening"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text="@string/form_evening" /&gt;
          &lt;/LinearLayout&gt;
      &lt;/TableRow&gt;
  
      &lt;TableRow
          android:id="@+id/table_row_thursday"
          android:layout_height="wrap_content"
          android:layout_width="match_parent"&gt;
  
          &lt;TextView
              android:id="@+id/text_thursday"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="@string/form_thursday"/&gt;
  
          &lt;LinearLayout
              android:id="@+id/layout_thursday_morning"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"&gt;
  
              &lt;CheckBox
                  android:id="@+id/checkbox_thursday_morning"
                  android:layout_height="wrap_content"
                  android:drawSelectorOnTop="true"
                  android:clickable="false"
                  android:layout_width="wrap_content" /&gt;
  
              &lt;TextView
                  android:id="@+id/text_thursday_morning"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text="@string/form_morning"/&gt;
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:id="@+id/layout_thursday_evening"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"&gt;
  
              &lt;CheckBox
                  android:id="@+id/checkbox_thursday_evening"
                  android:layout_height="wrap_content"
                  android:drawSelectorOnTop="true"
                  android:clickable="false"
                  android:layout_width="wrap_content" /&gt;
  
              &lt;TextView
                  android:id="@+id/text_thursday_evening"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text="@string/form_evening" /&gt;
          &lt;/LinearLayout&gt;
      &lt;/TableRow&gt;
  &lt;/TableLayout&gt;
  </code></pre>
  
  <p>I have checkboxes (instead of nodes to fill). I tried to convert the <code>TableLayout</code> to <code>GridLayout</code> (without checkboxes) but it looks like not a trivial mission. From this <a href="https://stackoverflow.com/questions/10016343/gridlayout-not-gridview-how-to-stretch-all-children-evenly">topic</a> I learn it is not easy to starch the rows. What would be the easiest way of creating such table with <code>Grid</code> with API 16?</p>