There are four main layouts for the Android interface, Relativelayout, LinearLayout, Tablelayout, Framelayout, respectively, and how they are used (for the sake of simplicity, the next introduction works, I enclose the code of the layout file separately, for your reference)
One: Relativelayout
<?xml version= "1.0" encoding= "Utf-8"?>
<relativelayout xmlns:android= "Http://schemas.android.com/apk/res/android"
Android:layout_width= "Match_parent"
android:layout_height= "Match_parent"
android:background= "@drawable/background" >
<textview
Android:id= "@+id/background_textview"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
android:text= "Type here"/>
<edittext
Android:id= "@+id/background_edittext1"
Android:layout_width= "Fill_parent"
android:layout_height= "Wrap_content"
android:layout_below= "@id/background_textview"
android:background= "@android:d rawable/editbox_background"/>
<button
Android:id= "@+id/background_button_ok"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
android:layout_below= "@id/background_edittext1"
Android:layout_alignparentright= "true"
android:layout_marginleft= "10px"
android:text= "OK"/>
<button
Android:id= "@+id/background_button_cancel"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
android:layout_below= "@id/background_edittext1"
android:layout_toleftof= "@id/background_button_ok"
android:layout_aligntop= "@id/background_button_ok"
android:text= "Cancel"/>
</RelativeLayout>
:
Two: nested layouts
<?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:orientation= "Vertical"
android:background= "@drawable/background" >
<relativelayout
Android:layout_width= "Fill_parent"
android:layout_height= "40DP"
android:background= "@drawable/background_blue" >
<textview
Android:id= "@+id/multilayout_textview1"
android:layout_margintop= "15DP"
Android:layout_width= "Wrap_content"
android:layout_height= "Fill_parent"
Android:textcolor= "@color/abc_search_url_text_holo"
android:text= "PhoneNumber:"/>
<edittext
Android:id= "@+id/multilayout_edittext"
Android:layout_width= "Fill_parent"
android:layout_height= "Wrap_content"
android:minlines= "1"
android:maxlines= "1"
android:layout_torightof= "@id/multilayout_textview1"
android:background= "@android:d rawable/editbox_background"
android:layout_alignbottom= "@id/multilayout_textview1"
/>
</RelativeLayout>
<textview
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
android:text= "Please Input the Message to Send"/>
<edittext
Android:id= "@+id/multilayout_edittext2"
Android:layout_width= "Fill_parent"
android:layout_height= "Wrap_content"
Android:minlines= "3"
android:maxlines= "7"
android:background= "@android:d rawable/editbox_background"/>
<button
Android:id= "@+id/multilayout_button"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
android:text= "Send"/>
</LinearLayout>
:
Three: Table layout
<?xml version= "1.0" encoding= "Utf-8"?>
<tablelayout xmlns:android= "Http://schemas.android.com/apk/res/android"
Android:layout_width= "Match_parent"
android:layout_height= "Match_parent"
android:stretchcolumns= "1" >
<tablerow
Android:layout_width= "Fill_parent"
android:layout_height= "100DP" >
<textview
Android:id= "@+id/table_layout_textview1"
Android:layout_width= "Wrap_content"
android:layout_height= "Fill_parent"
android:text= "phone number:"/>
<edittext
Android:id= "@+id/table_layout_edittext1"
Android:layout_width= "Wrap_content"
android:layout_height= "Fill_parent"/>
</TableRow>
<tablerow
Android:layout_width= "Fill_parent"
android:layout_height= "200DP" >
<textview
Android:id= "@+id/table_layout_textview2"
Android:layout_width= "Wrap_content"
android:layout_height= "Fill_parent"
android:text= "SMS content:"/>
<edittext
Android:id= "@+id/table_layout_edittext2"
Android:layout_width= "Wrap_content"
android:layout_weight= "1"
Android:minlines= "3"
android:maxlines= "7"
android:layout_height= "Fill_parent"/>
</TableRow>
<tablerow
Android:layout_width= "Fill_parent"
android:layout_height= "50DP" >
<button
Android:id= "@+id/table_layout_button1"
Android:layout_width= "Fill_parent"
android:layout_height= "Fill_parent"
android:text= "Send"/>
</TableRow>
</TableLayout>
:
Four: Frame layout
<?xml version= "1.0" encoding= "Utf-8"?>
<framelayout xmlns:android= "Http://schemas.android.com/apk/res/android"
Android:layout_width= "Match_parent"
android:layout_height= "Match_parent" >
<imageview
Android:layout_width= "Fill_parent"
android:layout_height= "Fill_parent"
android:src= "@drawable/movie"/>
<imageview
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
android:src= "@drawable/pause"
android:layout_gravity= "Center"/>
</FrameLayout>
: This layout is, the second ImageView covers the first ImageView
Note: The above layout is simple, only for later to forget the reference