Consider the following trivial layout.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="bottom"
    android:orientation="vertical" >
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:layout_gravity="top" >
        <Button
            android:id="@+id/button1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Button" />
    </LinearLayout>
</LinearLayout>
The outer LinearLayout specifies that it has
android:gravity="bottom"
which means that it wants its children to "fall to the bottom".
The inner LinearLayout specifies that
android:layout_gravity="top"
which means that it wants itself to be laid out at the top of its enclosing layout. (To specify android:layout_gravity one must apparently edit the XML file directly. There does not seem to be a way to reach that attribute from Eclipse. Anyhow...)
How does Android resolve such a conflict? The example above suggests that the gravity attribute overrides the layout_gravity attribute. Is that how the conflict is resolved in general?
 
    