[TIMOB-7819] Android: View - height:'auto' causing view to expand rather than contract to the size of its children
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-05-03T17:33:26.000+0000 |
Affected Version/s | Release 1.8.1, Release 1.8.2 |
Fix Version/s | Release 2.0.0, Sprint 2012-06 |
Components | Android |
Labels | module_view, parity, qe-testadded |
Reporter | Jon Alter |
Assignee | Allen Yeung |
Created | 2012-02-27T09:08:27.000+0000 |
Updated | 2012-05-03T17:33:26.000+0000 |
Description
View does not resize correctly when height set to 'auto'. It should contract to the size of its children.
iPhone works correctly. See attached screenshot.
Steps to reproduce:
Step 1: run the code below. Step 2: notice that the second red block fills the bottom of the screen. It should only be ass tall as its child label as it is on the iphone in the attached screenshot.
var win = Ti.UI.createWindow({
backgroundColor: 'white'
});
win.open();
var view1 = Ti.UI.createView({
top: 10,
height: 100,
backgroundColor: 'red',
});
var label1 = Ti.UI.createLabel({
text: 'Static',
height: 'auto',
width: 'auto',
backgroundColor: 'yellow',
});
var view3 = Ti.UI.createView({
top: 120,
height: 'auto',
backgroundColor: 'red',
});
var label2 = Ti.UI.createLabel({
text: 'Auto',
height: 'auto',
width: 'auto',
backgroundColor: 'yellow',
});
win.add(view1);
view1.add(label1);
win.add(view3);
view3.add(label2);
Attachments
File | Date | Size |
---|---|---|
view-height-auto.jpg | 2012-02-27T09:08:27.000+0000 | 47261 |
This has been fixed as a part of the composite layout behavior spec (https://wiki.appcelerator.org/display/guides2/UI+Composite+Layout+Behavior+Spec) . Views should have the fill behavior by default. So the android behavior as specified in this bug is the correct behavior and the new behavior in iOS matches this as well.
Closing bug. Verified fix on: SDK build: 2.0.0.v20120316124800 Runtime: v8, rhino Titanium Studio, build: 2.0.0.201203152033 Device: Nexus S (2.3.6)
Open to update label