title: Android: how to align views vertically and horizontally
body: <p>I'm wondering how I can align the buttons as the following: Button1 and Button2-2 are supposed to align horizontally, Button2-1 and Button2-2 should align vertically.</p>
  
  <pre><code>                        [Button2-1]
  [other views] [Button1] [Button2-2]
  </code></pre>
  
  <p>Here is my code but it doesn't work:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/ButtonGroups"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:gravity="center"
      android:orientation="vertical" &gt;
  
      &lt;LinearLayout
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:gravity="center"
          android:orientation="horizontal" &gt;
  
          &lt;Button
              android:id="@+id/Button1"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="center" /&gt;
  
          &lt;LinearLayout
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:gravity="center"
              android:orientation="vertical" &gt;
  
              &lt;Button
                  android:id="@+id/Button2-1"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_gravity="center" /&gt;
  
              &lt;Button
                  android:id="@+id/Button2-2"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_gravity="center" /&gt;
          &lt;/LinearLayout&gt;
      &lt;/LinearLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <hr>
  
  <p><strong>EDITED:</strong></p>
  
  <p>To be more clear, I posted more code here and hopefully it could explain my needs better:</p>
  
  <p>What I want is to align the text view horizontally with the image buttons while vertically with the seekbar above it.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/ButtonGroups"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:gravity="center"
      android:orientation="vertical" &gt;
  
      &lt;LinearLayout
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:gravity="center"
          android:orientation="horizontal" &gt;
  
          &lt;ImageButton
              android:id="@+id/Button00"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:background="@drawable/background00"
              android:gravity="bottom"
              android:scaleType="center"
              android:src="@drawable/button00" /&gt;
  
           &lt;ImageButton android:id="@+id/Button11"
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:src="@drawable/button11"
               android:scaleType="center"
               android:gravity="bottom"
               android:background="@drawable/background11"
               /&gt;
  
          &lt;LinearLayout
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:gravity="bottom"
              android:orientation="vertical" &gt;
  
             &lt;SeekBar
                      android:id="@+id/SeekBar1"
                      style="@style/MySeekBar1"
                      android:layout_width="60dp"  
                      android:layout_height="35dp"
                      android:layout_marginBottom="20dp"
                  /&gt;
  
              &lt;TextView
                      android:id="@+id/MyText"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:gravity="bottom"
                      android:background="@drawable/MyTextImg"
                  /&gt;
          &lt;/LinearLayout&gt;
      &lt;/LinearLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>