Mercurial > dwindows
changeset 2681:c1482518b643
Android: Fix weight based layout problems.
To use weight, the width/height needs to be set to 0.
So if we are in a situation where we can use weight... meaning the layout is
in the correct direction, and we have a valid weight then set the weight and
force the width or height to 0.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Mon, 25 Oct 2021 11:29:34 +0000 |
parents | 1888d0a08365 |
children | 856d3c8b559f |
files | android/DWindows.kt |
diffstat | 1 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/android/DWindows.kt Mon Oct 25 03:41:02 2021 +0000 +++ b/android/DWindows.kt Mon Oct 25 11:29:34 2021 +0000 @@ -1731,12 +1731,14 @@ // Handle expandable items by giving them a weight... // in the direction of the box. if (box.orientation == LinearLayout.VERTICAL) { - if (vsize != 0) { + if (vsize != 0 && weight > 0F) { params.weight = weight + params.height = 0 } } else { - if (hsize != 0) { + if (hsize != 0 && weight > 0F) { params.weight = weight + params.width = 0 } } // Gravity needs to match the expandable settings