# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1621628923 0 # Node ID 5beaaa4e9b0385932fe5c77765cd84a665443117 # Parent 5b13bb267364cbc2ed66ee7f72d50303c18920a9 Android: Improve the layout, if an item expands in the opposite direction of the box... Then use MATCH_PARENT... use weight if it expands in the direction of the box. diff -r 5b13bb267364 -r 5beaaa4e9b03 android/DWindows.kt --- a/android/DWindows.kt Fri May 21 19:50:56 2021 +0000 +++ b/android/DWindows.kt Fri May 21 20:28:43 2021 +0000 @@ -1241,13 +1241,17 @@ w = width } } else { - if (width > 0) { - weight = width.toFloat() - } else if (width == -1) { - val newwidth = item.getMeasuredWidth() - - if(newwidth > 0) { - weight = newwidth.toFloat() + if (box.orientation == LinearLayout.VERTICAL) { + w = LinearLayout.LayoutParams.MATCH_PARENT + } else { + if (width > 0) { + weight = width.toFloat() + } else if (width == -1) { + val newwidth = item.getMeasuredWidth() + + if (newwidth > 0) { + weight = newwidth.toFloat() + } } } } @@ -1256,13 +1260,17 @@ h = height } } else { - if (height > 0) { - weight = height.toFloat() - } else if (height == -1) { - val newheight = item.getMeasuredHeight() - - if(newheight > 0) { - weight = newheight.toFloat() + if (box.orientation == LinearLayout.HORIZONTAL) { + h = LinearLayout.LayoutParams.MATCH_PARENT + } else { + if (height > 0) { + weight = height.toFloat() + } else if (height == -1) { + val newheight = item.getMeasuredHeight() + + if (newheight > 0) { + weight = newheight.toFloat() + } } } }