I divide a LinearLayout into say 7 different Views using weight_sum = 7 and the Views each have layout_weight = 1.
The whole LinearLayout spans over 100 pixels on the device.
100 pixels / 7 = 14.29 pixels.
Since pixels can only be integers the actual size in pixels of the 7 child views will be like this:
14 – 14 – 14 – 14 – 14 – 15 – 15
I’m now wondering which formula Android uses to calculate where to round down and where to round up.
For positioning, I would need to know it for any LinearLayout of size x with y child views.
From the source code, it casts the division to an
int. See line 441.Therefore, it always takes the floor integer value