Android layout_weight case analysis summary

Regarding layout_weight, we generally understand the meaning of layout weight. The official Android description is as follows:
Formats: float
Indicates how much of the extra space in the LinearLayout is allocated to the view associated with these LayoutParams. Specify 0 if the view should not be stretched. Otherwise the extra pixels will be pro-rated among all views whose weight is greater than 0.

The assignable type is float, and
the meaning of layout_weight is: in the linear layout, the proportion of the blank area occupied by these controls.
If it is 0, it means that the control will not be stretched to fit the layout; other values ​​indicate the proportion of the control in the blank area of ​​the layout.

Take a look at the actual example:
Insert picture description here

<?xml version="1.0" encoding="utf-8"

Guess you like

Origin blog.csdn.net/poolooloo/article/details/106921543