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>
external LinearLayout indicates that it has
android:gravity="bottom"
which means that he wants his children to "fall to the bottom."
internal LinearLayout indicates that
android:layout_gravity="top"
which means that he wants him to be laid out at the top of his closing layout. (To indicate android:layout_gravity, you need to apparently edit the XML file directly. There seems to be no way to get this attribute from Eclipse. Anyway ...)
How does Android resolve this conflict? The example above assumes the attribute gravityoverrides the attribute layout_gravity. So how is the conflict resolved at all?