Mercurial > dwindows
comparison android/DWindows.kt @ 2575:5beaaa4e9b03
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.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Fri, 21 May 2021 20:28:43 +0000 |
parents | 5b13bb267364 |
children | db097ec28c90 |
comparison
equal
deleted
inserted
replaced
2574:5b13bb267364 | 2575:5beaaa4e9b03 |
---|---|
1239 if(hsize == 0) { | 1239 if(hsize == 0) { |
1240 if (width > 0) { | 1240 if (width > 0) { |
1241 w = width | 1241 w = width |
1242 } | 1242 } |
1243 } else { | 1243 } else { |
1244 if (width > 0) { | 1244 if (box.orientation == LinearLayout.VERTICAL) { |
1245 weight = width.toFloat() | 1245 w = LinearLayout.LayoutParams.MATCH_PARENT |
1246 } else if (width == -1) { | 1246 } else { |
1247 val newwidth = item.getMeasuredWidth() | 1247 if (width > 0) { |
1248 | 1248 weight = width.toFloat() |
1249 if(newwidth > 0) { | 1249 } else if (width == -1) { |
1250 weight = newwidth.toFloat() | 1250 val newwidth = item.getMeasuredWidth() |
1251 | |
1252 if (newwidth > 0) { | |
1253 weight = newwidth.toFloat() | |
1254 } | |
1251 } | 1255 } |
1252 } | 1256 } |
1253 } | 1257 } |
1254 if(vsize == 0) { | 1258 if(vsize == 0) { |
1255 if (height > 0) { | 1259 if (height > 0) { |
1256 h = height | 1260 h = height |
1257 } | 1261 } |
1258 } else { | 1262 } else { |
1259 if (height > 0) { | 1263 if (box.orientation == LinearLayout.HORIZONTAL) { |
1260 weight = height.toFloat() | 1264 h = LinearLayout.LayoutParams.MATCH_PARENT |
1261 } else if (height == -1) { | 1265 } else { |
1262 val newheight = item.getMeasuredHeight() | 1266 if (height > 0) { |
1263 | 1267 weight = height.toFloat() |
1264 if(newheight > 0) { | 1268 } else if (height == -1) { |
1265 weight = newheight.toFloat() | 1269 val newheight = item.getMeasuredHeight() |
1270 | |
1271 if (newheight > 0) { | |
1272 weight = newheight.toFloat() | |
1273 } | |
1266 } | 1274 } |
1267 } | 1275 } |
1268 } | 1276 } |
1269 } | 1277 } |
1270 | 1278 |