Android trying to center 2 Images, but they get right justfied
<p>I have a layout with a image of the card on the left hand side. The right hand side has 2 buttons on top.  Then 2 images below them, and one image below the 2 images.</p>

<p>I would like the 2 images and 1 image to get centered.  The row with 1 image gets centred all right.
code:
                <br>
          

<pre><code>   /&gt;

        &lt;ImageView 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/viewmail"
        android:src="@drawable/mail"

   /&gt;
   &lt;/LinearLayout&gt;     
</code></pre>

<p>I create a horizontal container for the 2 images and set it's gravity to center.  This is not working.  I also tried to set the gravty to center on the 2 images.  But.... they always stay to the left hand side.</p>

<p>ALL THE CODE
xml file 
</p>

<pre><code>          &lt;LinearLayout
android:id="@+id/mainLayout"
</code></pre>

<p>android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:layout_gravity="center"<br>
  android:orientation="vertical">
 
 
    android:background="@drawable/background"
  android:orientation="vertical"></p>

<p>
  android:orientation="horizontal"></p>

<pre><code>   &lt;LinearLayout
android:id="@+id/mainLayout"
</code></pre>

<p>android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:orientation="vertical">
       
 </p>

<pre><code>&lt;LinearLayout
android:id="@+id/mainLayout"
</code></pre>

<p>android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:orientation="vertical"></p>

<pre><code>             &lt;LinearLayout
android:id="@+id/mainLayout"
</code></pre>

<p>android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:layout_gravity="center"<br>
  android:orientation="horizontal">  </p>

<pre><code>      &lt;ImageView 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/buthome"
        android:src="@drawable/ok"

   /&gt;

         &lt;ImageView 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/butaffirmation"
        android:src="@drawable/affirmation"

   /&gt;      
</code></pre>

<p>   </p>

<pre><code>                          &lt;LinearLayout
android:id="@+id/mainLayout"
</code></pre>

<p>android:layout_width="fill_parent"
  android:layout_height="wrap_content"
    android:layout_gravity="center" 
  android:orientation="horizontal">   </p>

<p>I AM TRYING TO CENTER THSES 2 IMAGES</p>

<p></p>

<pre><code>        &lt;ImageView 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/viewmail"
        android:src="@drawable/mail"
        android:layout_gravity="center" 
   /&gt;
   &lt;/LinearLayout&gt;     

        &lt;ImageView 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/vietwitter"
        android:src="@drawable/twitter"
        android:layout_gravity="center" 
   /&gt;



      &lt;LinearLayout
android:id="@+id/mainLayout"
</code></pre>

<p>android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:orientation="horizontal">         </p>

<pre><code>            &lt;TextView
            android:layout_width="wrap_content"
            android:id="@+id/housetext"
            android:layout_height="wrap_content"
            android:text=" *A long and happy marriage or commitment is in your future.\n*Emotional security (loyalty and trust) exists in your relationship.\n*You will have a stable home and family life.\nThe marriage card is about a person who is either going get married or who really cherishes the whole institution of marriage."
            android:textSize="18px"
            android:textColor="#ff000000"
            android:textStyle="bold"
             /&gt;  

    &lt;/LinearLayout&gt;    
</code></pre>

<p> </p>

<p> </p>

<pre><code> &lt;ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
</code></pre>

<p>android:layout_height="fill_parent" 
  android:layout_width="fill_parent"></p>

<pre><code>            &lt;TextView
            android:layout_width="wrap_content"
            android:id="@+id/cardtext"
            android:layout_height="wrap_content"
            android:text=" *A long and happy marriage or commitment is in your future.\n*Emotional security (loyalty and trust) exists in your relationship.\n*You will have a stable home and family life.\nThe marriage card is about a person who is either going get married or who really cherishes the whole institution of marriage."
            android:textSize="20dp"
            android:textColor="#ff000000"
            android:textStyle="bold"
             /&gt;
 &lt;/ScrollView&gt;
</code></pre>

<p>

