Learn reprint from the place: http://hukai.me/android-training-course-in-chinese/basics/firstapp/building-ui.html, if there is infringement please tell me, I immediately delete
The first step: Create a new project using Android Studio, with the following directory
Step two: Punch in the Activity_my.xml file, modify the contents of the file
Modify the String.xml file
After modifying the design page display effect:
Android:orientation: This property sets the placement direction of the control, horizontal represents horizontal placement, and vertical represents portrait placement;
Wrap_content: automatic stretching according to content;
Match_parent: Mandatory to extend the view to the parent element size;
As shown, this setting is appropriate for the button, but not good for the text box, because the user may enter a longer content, so that the text box fills the full width of the button,
LinearLayout Use the weight attribute to achieve this purpose, so you can modify the text box's android:layout_weight to set, Android for all view default weight is 0, such as
If only one view is set to a weight greater than 0, the view occupies all the remaining space to remove the space occupied by the other view itself. The weight of the edittext is therefore set to 1 so that it can account for
All the space except the button.
Modify the following:
For example, the whole line is full after the modification
Android Beginner to create a simple user interface