[Plain]
Android: layout_above: Move the control's bottom to the control with the given ID
Android: layout_below: place the top of the control under the control with the given ID
Android: layout_toLeftOf align the right edge of the control with the left edge of the control with the given ID
Android: layout_toRightOf align the left edge of the control with the right edge of the control with the given ID
Android: layout_alignBaseline the baseline of the control is aligned with the baseline of the control with the given ID
Android: layout_alignBottom: Compares the bottom edge of the control with the bottom edge of the given ID control.
Android: layout_alignLeft: Align the left edge of the control with the given ID
Android: layout_alignRight: Align the right edge of the control with the right edge of the given ID Control
Android: layout_alignTop: aligntop
Android: alignParentBottom if the value is true, the bottom of the control is aligned with the bottom of the parent control.
Android: layout_alignParentLeft if the value is true, the left side of the control is aligned with the left side of the parent control.
Android: layout_alignParentRight if the value is true, the right side of the control is aligned with the right side of the parent control.
Android: layout_alignParentTop if the value is true, the top of the space is aligned with the top of the parent control.
Android: layout_centerHorizontal
Android: layout_centerInParent if the value is true, the control is centered in the horizontal and vertical directions of the parent control.
Android: layout_centerVertical if the value is true, the control will be centered in the vertical direction
Android: layout_above: Move the control's bottom to the control with the given ID
Android: layout_below: place the top of the control under the control with the given ID
Android: layout_toLeftOf align the right edge of the control with the left edge of the control with the given ID
Android: layout_toRightOf align the left edge of the control with the right edge of the control with the given ID
Android: layout_alignBaseline the baseline of the control is aligned with the baseline of the control with the given ID
Android: layout_alignBottom: Compares the bottom edge of the control with the bottom edge of the given ID control.
Android: layout_alignLeft: Align the left edge of the control with the given ID
Android: layout_alignRight: Align the right edge of the control with the right edge of the given ID Control
Android: layout_alignTop: aligntop
Android: alignParentBottom if the value is true, the bottom of the control is aligned with the bottom of the parent control.
Android: layout_alignParentLeft if the value is true, the left side of the control is aligned with the left side of the parent control.
Android: layout_alignParentRight if the value is true, the right side of the control is aligned with the right side of the parent control.
Android: layout_alignParentTop if the value is true, the top of the space is aligned with the top of the parent control.
Android: layout_centerHorizontal
Android: layout_centerInParent if the value is true, the control is centered in the horizontal and vertical directions of the parent control.
Android: layout_centerVertical if the value is true, the control will be centered in the vertical direction
Ii. Code display:
1. "Acticity_07srcyanacticity_07MainActivity.java"
[Java]
Package yan. activity_07;
Import android. OS. Bundle;
Import android. app. Activity;
Import android. view. Menu;
Public class MainActivity extends Activity {
@ Override
Protected void onCreate (Bundle savedInstanceState ){
Super. onCreate (savedInstanceState );
SetContentView (R. layout. activity_main );
}
@ Override
Public boolean onCreateOptionsMenu (Menu menu ){
// Inflate the menu; this adds items to the action bar if it is present.
GetMenuInflater (). inflate (R. menu. activity_main, menu );
Return true;
}
}
Package yan. activity_07;
Import android. OS. Bundle;
Import android. app. Activity;
Import android. view. Menu;
Public class MainActivity extends Activity {
@ Override
Protected void onCreate (Bundle savedInstanceState ){
Super. onCreate (savedInstanceState );
SetContentView (R. layout. activity_main );
}
@ Override
Public boolean onCreateOptionsMenu (Menu menu ){
// Inflate the menu; this adds items to the action bar if it is present.
GetMenuInflater (). inflate (R. menu. activity_main, menu );
Return true;
}
}
2. "Acticity_07reslayoutactivity_main.xml"
[Html]
<? Xml version = "1.0" encoding = "UTF-8"?>
<! --
Android: layout_above: Move the control's bottom to the control with the given ID
Android: layout_below: place the top of the control under the control with the given ID
Android: layout_toLeftOf align the right edge of the control with the left edge of the control with the given ID
Android: layout_toRightOf align the left edge of the control with the right edge of the control with the given ID
Android: layout_alignBaseline the baseline of the control is aligned with the baseline of the control with the given ID
Android: layout_alignBottom: Compares the bottom edge of the control with the bottom edge of the given ID control.
Android: layout_alignLeft: Align the left edge of the control with the given ID
Android: layout_alignRight: Align the right edge of the control with the right edge of the given ID Control
Android: layout_alignTop: aligntop
Android: alignParentBottom if the value is true, the bottom of the control is aligned with the bottom of the parent control.
Android: layout_alignParentLeft if the value is true, the left side of the control is aligned with the left side of the parent control.
Android: layout_alignParentRight if the value is true, the right side of the control is aligned with the right side of the parent control.
Android: layout_alignParentTop if the value is true, the top of the space is aligned with the top of the parent control.
Android: layout_centerHorizontal
Android: layout_centerInParent if the value is true, the control is centered in the horizontal and vertical directions of the parent control.
Android: layout_centerVertical if the value is true, the control will be centered in the vertical direction
-->
<RelativeLayout xmlns: android = "http://schemas.android.com/apk/res/android"
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
Android: padding = "10px">
<TextView android: id = "@ + id/label"
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
Android: text = "Type here:"/>
<EditText android: id = "@ + id/entry"
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
Android: background = "@ android: drawable/editbox_background"
Android: layout_below = "@ id/label"/>
<Button android: id = "@ + id/OK"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: layout_below = "@ id/entry"
Android: layout_alignParentRight = "true"
Android: layout_marginLeft = "10px"
Android: text = "OK"/>
<Button android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: layout_toLeftOf = "@ id/OK"
Android: layout_alignTop = "@ id/OK"
Android: text = "Cancel"/>
</RelativeLayout>
<? Xml version = "1.0" encoding = "UTF-8"?>
<! --
Android: layout_above: Move the control's bottom to the control with the given ID
Android: layout_below: place the top of the control under the control with the given ID
Android: layout_toLeftOf align the right edge of the control with the left edge of the control with the given ID
Android: layout_toRightOf align the left edge of the control with the right edge of the control with the given ID
Android: layout_alignBaseline the baseline of the control is aligned with the baseline of the control with the given ID
Android: layout_alignBottom: Compares the bottom edge of the control with the bottom edge of the given ID control.
Android: layout_alignLeft: Align the left edge of the control with the given ID
Android: layout_alignRight: Align the right edge of the control with the right edge of the given ID Control
Android: layout_alignTop: aligntop
Android: alignParentBottom if the value is true, the bottom of the control is aligned with the bottom of the parent control.
Android: layout_alignParentLeft if the value is true, the left side of the control is aligned with the left side of the parent control.
Android: layout_alignParentRight if the value is true, the right side of the control is aligned with the right side of the parent control.
Android: layout_alignParentTop if the value is true, the top of the space is aligned with the top of the parent control.
Android: layout_centerHorizontal
Android: layout_centerInParent if the value is true, the control is centered in the horizontal and vertical directions of the parent control.
Android: layout_centerVertical if the value is true, the control will be centered in the vertical direction
-->
<RelativeLayout xmlns: android = "http://schemas.android.com/apk/res/android"
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
Android: padding = "10px">
<TextView android: id = "@ + id/label"
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
Android: text = "Type here:"/>
<EditText android: id = "@ + id/entry"
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
Android: background = "@ android: drawable/editbox_background"
Android: layout_below = "@ id/label"/>
<Button android: id = "@ + id/OK"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: layout_below = "@ id/entry"
Android: layout_alignParentRight = "true"
Android: layout_marginLeft = "10px"
Android: text = "OK"/>
<Button android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: layout_toLeftOf = "@ id/OK"
Android: layout_alignTop = "@ id/OK"
Android: text = "Cancel"/>
</RelativeLayout>
Iii. effect display: