Deprecated linear-weight-sum
This API is deprecated.
Introduction
Child element's weight sum in linear.
When linear-weight-sum property of the linear view is non-zero.
-
The linear-layout first lays out all the child elements whose
linear-weight:0, and calculates the width of these child elements in the layout direction. -
The remaining
linear-weightnon-zero child elements will be allocated the remaining width(linear layout view width minus the width of alllinear-weight:0child elements) in the main axis according to theirlinear-weight. For ease of presentation, we view "the sum of the childrenlinear-weight" as symbol "S".-
When
linear-weight-sum<= S:main size of child = corresponding linear-weight ÷ S ✖️ remaining main size width
-
When
linear-weight-sum> S:main size of child = corresponding linear-weight ÷ linear-weight-sum ✖️ remaining main size width
-
1.linear container's main axis size need set a fixed value;
2.It is not supported to use a fixed value and weight at the same time. If there is a linear-weight, the fixed value is automatically ignored (performance first);
Examples
In the figure, the width of the parent element is 400px, the first element is fixed at 100px, and the remaining width is 300px. The second and third elements specify the size, and are allocated according to the weight. The second element is 200px wide and the third element is 100px wide.

Syntax
Values
-
Negative values are invalid. Default value is 0.
Formal definition
| Initial value | 0 |
| Applies to | linear containers |
| Inherited | no |
| Animatable |
Formal syntax
Difference between web
- No such style in Web.
Compatibility
LCD tables only load in the browser
FAQ
-
linear container's main axis size need set a fixed value;
-
It is not supported to use a fixed value and weight at the same time. If there is a linear-weight, the fixed value is automatically ignored (performance first);