title: Android - Tile Image Button
body: <p>I am trying to tile image buttons to look like this in Android :</p>
  
  <p><a href="https://i.stack.imgur.com/xm2TN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xm2TN.png" alt="Tile Image Buttons"></a>
  .</p>
  
  <p>To achieve this I tried it using <code>RelativeLayout</code>, without any success.</p>
  
  <p>The XML layout that I used is as the following :</p>
  
  <pre><code>    &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:orientation="horizontal" android:layout_width="match_parent"
          android:layout_height="match_parent"&gt;
  
          &lt;ImageButton android:id="@+id/ibutton1" 
              android:layout_width="wrap_content"
              android:layout_height="wrap_content" 
              android:src="@drawable/ic_launcher"&gt;&lt;/ImageButton&gt;
  
          &lt;ImageButton android:id="@+id/ibutton2" 
              android:layout_width="wrap_content"
              android:layout_height="wrap_content" 
              android:layout_below="@+id/ibutton1"  
              android:src="@drawable/ic_launcher"&gt;&lt;/ImageButton&gt;
  
          &lt;ImageButton android:id="@+id/ibutton3" 
              android:layout_width="wrap_content"
              android:layout_height="wrap_content" 
              android:layout_toRightOf="@+id/ibutton1" 
              android:src="@drawable/ic_launcher"&gt;&lt;/ImageButton&gt;
  
          &lt;ImageButton android:id="@+id/ibutton4" 
              android:layout_width="wrap_content"
              android:layout_height="wrap_content" 
              android:layout_toRightOf="@+id/ibutton2" 
              android:src="@drawable/ic_launcher"&gt;&lt;/ImageButton&gt;
  
      &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>What is the correct way to achieve this?</p>
  
  <p>Additional question : is there a way to perform this programmatically?</p>
  
  <p>Thanks in advance</p>