<?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:paddingleft= "16DP" android:paddingright= "16DP" android:orientation= "vertical" > <edittext android:layout_width= "Fill_ Parent " android:layout_height=" Wrap_content " android:hint= "@string/to" /> <EditText android:layout_width= "Fill_parent" android:layout_height= "Wrap_content" android: hint= "@string/subject" /> &Nbsp; <edittext android:layout_width= "Fill_parent " android:layout_height=" 0DP " android:layout_weight= "1" android:gravity= " Top " android:hint=" @string/message " /> <button android:layout_width= "100DP" android:layout_height= "Wrap_content" android:layout_gravity= "Right" android:text= "@ String/send " /></LinearLayout><!-- android:orientation=" vertical " Direction Vertical--><!-- android:layout_weight= "1" represents the weight (scale) Message fills the rest of the other elements, if there are multiple android:layout_weIght=1, then split the remaining space android:gravity= "top" means starting from above (wrote Android:layout_weight) Android:layout_gravity= "Right" the entire component is located
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/8B/42/wKiom1hIFsWCFl9PAABRkFm5EbE270.png-wh_ 500x0-wm_3-wmp_4-s_617713268.png "title=" capture. PNG "alt=" wkiom1hifswcfl9paabrkfm5ebe270.png-wh_50 "/>
<?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:paddingleft= "16DP" android:paddingright= "16DP" android:orientation= "Horizontal" > <edittext android:layout_width= "Wrap _content " android:layout_height=" Wrap_content " android:hint= "@string/to" /> <edittext android:layout_width= "Wrap_content" android:layout_height= "Wrap_content" android:hint= "@string/subject" />&nbSp; <edittext android:layout_width= "Wrap_ Content " android:layout_height=" 0DP android:layout_weight= "1" android: gravity= "Top" android:hint= "@string/message" /> <button android:layout_width= "100DP" android:layout_height= "Wrap_content" android:layout_gravity= "Right" android:text= " @string/send " /></LinearLayout>
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/8B/3F/wKioL1hIFxSSehAQAAAj4zxp0jY739.png-wh_500x0-wm_3 -wmp_4-s_3189827534.png "title=" capture. PNG "alt=" Wkiol1hifxssehaqaaaj4zxp0jy739.png-wh_50 "/>
LinearLayoutis a view group with all of its child views aligned in one direction, horizontal or vertical. You can specify the orientation of the layout through the android:orientation properties.
LinearLayoutall of the child view permutations are one against the other, so the vertical list has only one sub-view per row, no matter how wide. The horizontal list can have only one row of height (the height of the highest child view plus the margin distance). LinearLayoutexpect a child view betweenmargin, each child view hasGravity.
The linear layout supports setting weights for individual sub-views through the Android:layout_weight property. This property sets an important value for how much space a view occupies on the screen. A large weight value that allows it to be expanded to fill any remaining space in the parent view. A child view can specify a weight value, and then other space remaining in the view group will be assigned to its child view of the claim weight. The default weight is 0.
For example, if there are three text boxes, where two of the claims have a weight of 1, and the other one has no weight, no weight the third text field does not increase, only consumes the area the content requires. The other two will also expand to fill the remaining space after being measured in three text fields. If the third field is then given a weight of 2 (instead of 0), then it is now declared more important than the other, so it gets half the total remaining space, while the first two evenly distributes the remainder.
This article is from the "matengbing" blog, make sure to keep this source http://matengbing.blog.51cto.com/11395502/1880518
LinearLayout Layout for Android