[TIMOB-25173] Android: Size/Fill layout conflicts are not handled the same as iOS and Windows
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2017-08-22T19:20:45.000+0000 |
Affected Version/s | Release 3.3.0 |
Fix Version/s | Release 6.2.0 |
Components | Android |
Labels | android, layout |
Reporter | Joshua Quick |
Assignee | Joshua Quick |
Created | 2017-08-15T23:15:42.000+0000 |
Updated | 2017-08-22T23:14:36.000+0000 |
Description
*Summary:*
Android does not resolve a parent Ti.UI.SIZE and child Ti.UI.FILL conflict in the same manner as iOS and Windows Phone. The issue is that the parent wants to auto-size itself based on the child and the child wants to auto-size itself based on the parent. iOS and Windows resolves this by increasing the size of the child to fit the parent's parent. Android resolves this by shrinking the parent to just-fit the child's minimum size. Android should be changed to match iOS and Windows' behavior for portability.
*Cause:*
Titanium uses the Android MATCH_PARENT setting for Ti.UI.FILL. Unfortunately, the native Android behavior does not match iOS and Windows's behavior. Because of this, we cannot use this setting.
*Work-Around:*
Instead of using Ti.UI.FILL, you can use "100%" instead for vertical and composite layouts. However, this work-around will not work well in a horizontal layout if their are multiple views on the same row.
*Tests to reproduce:*
Please see the attached JavaScript files for testing:
- [^ListViewFillTest.js]
- [^SizeFillConflictTest.js]
- [^VerticalFillTest.js]
- [^HorizontalFillTest.js]
- [^HorizontalPinningTest.js]
There are also attached screenshots for each test script above. The "Bad" screenshots show the buggy behavior on Android. The "Good" screenshots are the expected results.
Attachments
File | Date | Size |
---|---|---|
HorizontalFill-Bad.png | 2017-08-15T23:14:05.000+0000 | 72804 |
HorizontalFill-Good.png | 2017-08-15T23:14:05.000+0000 | 83435 |
HorizontalFillTest.js | 2017-08-15T23:11:14.000+0000 | 6942 |
HorizontalPinning-Bad.png | 2017-08-18T02:23:52.000+0000 | 110986 |
HorizontalPinning-Good.png | 2017-08-18T02:23:52.000+0000 | 111091 |
HorizontalPinningTest.js | 2017-08-18T02:23:52.000+0000 | 3592 |
ListViewFill-Bad.png | 2017-08-15T23:13:40.000+0000 | 23609 |
ListViewFill-Good.png | 2017-08-15T23:13:40.000+0000 | 28240 |
ListViewFillTest.js | 2017-08-15T23:10:11.000+0000 | 611 |
SizeFillConflict-Bad.png | 2017-08-15T23:13:51.000+0000 | 22159 |
SizeFillConflict-Good.png | 2017-08-15T23:13:51.000+0000 | 25258 |
SizeFillConflictTest.js | 2017-08-15T23:10:36.000+0000 | 611 |
VerticalFill-Bad.png | 2017-08-15T23:13:58.000+0000 | 24987 |
VerticalFill-Good.png | 2017-08-15T23:13:58.000+0000 | 29073 |
VerticalFillTest.js | 2017-08-15T23:11:02.000+0000 | 1414 |
PR (master): https://github.com/appcelerator/titanium_mobile/pull/9320 PR (6.2.x): https://github.com/appcelerator/titanium_mobile/pull/9321
Passed FR. PR merged. Changes are seen in SDK versions: 6.2.0.v20170822113609 7.0.0.v20170822142802