Most of this article was excerpted from http://hukai.me/android-training-course-in-chinese/basics/firstapp/building-ui.html
Notice that the line of code where the cursor is located is commented out. The effect appears as shown on the right.
Uncomment, android:layout_weight= "1" function, the effect as shown on the right: compared to the previous picture, the text box occupies the blank space behind this line button, the button is "squeezed" to the far right.
Note: in order to improve the efficiency of the layout, when setting weights, the width of the edittext should be set to 0DP. If you set "Wrap_content" as the width, the system needs to calculate the width of the part itself, and because the weight is set, the system automatically takes up the remaining space, and the width of the edittext finally becomes a non-functional property.
(Android Studio) add buttons and weight issues