An incorrect understanding
The Android: layout_weight of each view (such as button) is shown in the parent view as a proportional relationship.
2. self-understanding
Weight is the identifier of importance. The greater the value, the more important it is.
The higher the importance, the stronger the ability to occupy the remaining space of the parent view. The remaining space may be large, small, or even unavailable.
Three examples prove your understanding
<? XML version = "1.0" encoding = "UTF-8"?>
<Linearlayout xmlns: Android = "http://schemas.android.com/apk/res/android" Android: Orientation = "horizontal" Android: layout_width = "fill_parent" Android: layout_height = "fill_parent">
<Button Android: layout_weight = "1" Android: Id = "@ + ID/btn_ OK" Android: layout_width = "wrap_content"Android: text = "button11111111111111111111111111111"Android: layout_height = "wrap_content"> </button>
<Button Android: layout_weight = "2" Android: Id = "@ + ID/btn_ok2" Android: layout_width = "wrap_content" Android: text = "button2"Android: layout_height = "wrap_content"> </button>
<Button Android: layout_weight = "3" Android: Id = "@ + ID/btn_ok3" Android: layout_width = "wrap_content" Android: text = "button3"Android: layout_height = "wrap_content"> </button>
</Linearlayout>
Btn_ok3 is of the highest importance, so it has the strongest available space in the parent view. The parent view is first displayed with btn_ OK and btn_ok2. The display of the two views is displayed according to the required content space. No matter how much space is left, the display is allocated to btn_ok3.