Android: layout_weight is used to allocate more space to the control.
Android: layout_gravity is used to set the location of the button relative to the parent view.
Layout is relative to the parent control.
<? Xml version = "1.0" encoding = "UTF-8"?> <LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android" android: layout_width = "fill_parent" android: layout_height = "fill_parent" android: orientation = "vertical" android: background = "# D1EEEE" android: paddingLeft = "16dp" android: paddingRight = "16dp"> <EditText android: layout_width = "fill_parent" android: layout_height = "wrap_content" android: hint = "to"/> <EditText android: layout_width = "fill _ Parent "android: layout_height =" wrap_content "android: hint =" subject "/> <SPAN style =" COLOR: # ff9966 "> // android: layout_weight is used to allocate more space to the Control </SPAN> <EditText android: layout_width = "fill_parent" android: layout_height = "0dp" android: layout_weight = "1" android: gravity = "top" android: hint = "message"/> <SPAN style = "COLOR: # ff9966 "> // the default position is align. </SPAN> <Button android: layout_width =" wrap_content "android: layout _ Height = "wrap_content" android: text = "Defaultsend"/> <SPAN style = "COLOR: # ff9900"> // android: layout_gravity is used to set the location of the button relative to the parent view </SPAN> <Button android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: layout_gravity = "right" android: text = "send"/> </LinearLayout> <? Xml version = "1.0" encoding = "UTF-8"?> <LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android" android: layout_width = "fill_parent" android: layout_height = "fill_parent" android: orientation = "vertical" android: background = "# D1EEEE" android: paddingLeft = "16dp" android: paddingRight = "16dp"> <EditText android: layout_width = "fill_parent" android: layout_height = "wrap_content" android: hint = "to"/> <EditText android: layout_width = "fill_parent" android: layout_height = "wrap_content" android: hint = "subject"/> // android: layout_weight is used to allocate more space to the Control <EditText android: layout_width = "fill_parent" android: layout_height = "0dp" android: layout_weight = "1" android: gravity = "top" android: hint = "message"/> // the default position is align. <Button android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: text = "Defaultsend"/> // android: layout_gravity is used to set the location of the button relative to the parent view. <Button android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: layout_gravity = "right" android: text = "send"/> </LinearLayout>