How you specify a linear layout
You specify a linear layout using <LinearLayout>. You must specify the layout’s widht, height, and orientation, but padding is optional:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" ....> .... </LinearLayout>
Views get displayed in the order they’re listed in the code
When you define a linear layout, you add views to the layout in the order in which you want them to appear.
Strech views using weight
By default, all views take up just as much space as necessary for their content. If you want to make one or more of your view take up more space, you can user the weight attribute to make it strech:
android:layout_weight=”1″
Use gravity to specify where a view’s content appear within a view
The android:gravity attribute lets you specify how you want to position the contents of a view – for example, how you want to position text inside a text field.
Use layout_gravity to specify where a view appears in its available space
The android:layout_gravity attribute lets you specify where you want a view in a linear layout to appear in its parent layout. You can use it to push aview to the end, for instance, or center the view horizontally.