android:orientation 属性。
margin,每个子视图都有gravity。
Layout Weight
Equally weighted children
To create a linear layout in which each child uses the same amount of
space on the screen, set the android:layout_height of each view to "0dp" (for a
vertical layout) or the android:layout_width of each view to "0dp" (for a
horizontal
layout). Then set the android:layout_weight of each view to "1".
线性布局支持给个别的子视图设定权重,通过android:layout_weight属性。就一个视图在屏幕上占多大的空间而言,这个属性给其设定了一个重要的值。一个大的权重值,允许它扩大到填充父视图中的任何剩余空间。子视图可以指定一个权重值,然后视图组剩余的其他的空间将会分配给其声明权重的子视图。默认的权重是0.
例如,如果有三个文本框,其中两个声明的权重为1,另外一个没有权重,没有权重第三个文本字段不会增加,只会占用其内容所需的面积。其他两个同样的会扩大以填补剩余的空间,在三个文本域被测量后。如果第三个字段,然后给定的权重为2(而不是0),那么它现在的声明比其他的更重要,所以它得到一半的总的剩余空间,而前两个平均分配剩余的。
Example
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:orientation="vertical" >
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="@string/to" />
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="@string/subject" />
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="top"
android:hint="@string/message" />
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="@string/send" />
For details about the attributes available to each child view of a