android:layout_gravity effect in main.xml?
<p>I have 4 buttons in a horizontal linear layout. I'd like the right edge of the 4th button to align with the right edge of the linear layout (equal to screen width) I've tried using android:layout_gravity="right" but it doesn't work - the right button is to the right of the 3rd one but not right aligned . Am I missing something obvious?</p>

<p>main.xml with only the relevant layout params only is:</p>

<pre><code>&lt;LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"&gt;
    &lt;LinearLayout
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"&gt;
       &lt;Button
           android:layout_height="fill_parent"
           android:layout_width="wrap_content"&gt;
       &lt;Button SAME LAYOUT AS BUTTON 1&gt;
       &lt;Button SAME LAYOUT AS BUTTON 1&gt;

       &lt;Button
           android:layout_height="fill_parent"
           android:layout_width="wrap_content"
           android:layout_gravity="right" /&gt;
    &lt;/LinearLayout&gt;
&lt;/LinearLayout&gt;
</code></pre>

<p>This doesn't seem to match the stated behaviour for layout_gravity in the SDK reference :"Defines how to place the view, both its x- and y-axis, within its parent view group." </p>
