title: statically create a gridview of 2X2 imageviews in Android
body: <p>I'm trying to create a view that will include 4 imageView in a 2x2 formation. This is what I had in mind:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/gridLayout1"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:columnCount="2"&gt;
  
      &lt;ImageView 
          android:id="@+id/pic1" 
          android:layout_row="0"
          android:layout_column="0"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:paddingRight="4dip" /&gt;
      &lt;ImageView 
          android:id="@+id/pic2" 
          android:layout_row="1"
          android:layout_column="0"
          android:layout_width="match_parent"
          android:layout_height="match_parent" /&gt;
      &lt;ImageView 
          android:id="@+id/pic3" 
          android:layout_row="0"
          android:layout_column="1"
          android:layout_width="match_parent"
          android:layout_height="match_parent"/&gt;
      &lt;ImageView 
          android:id="@+id/pic4" 
          android:layout_row="1"
          android:layout_column="1"
          android:layout_width="match_parent"
          android:layout_height="match_parent" /&gt;
  &lt;/GridLayout&gt;
  </code></pre>
  
  <p>This doesn't seem to work, as when I run </p>
  
  <pre><code>setContentView(R.layout.grid_view)
  </code></pre>
  
  <p>I get this error:</p>
  
  <pre><code>Binary XML file line #2: Error inflating class GridLayout
  </code></pre>
  
  <p>Does anyone know why this is happening? I tryed to follow the instructions on <a href="http://android-developers.blogspot.co.il/2011/11/new-layout-widgets-space-and-gridlayout.html" rel="nofollow">http://android-developers.blogspot.co.il/2011/11/new-layout-widgets-space-and-gridlayout.html</a> But it didn't help much</p>