[TIMOB-3363] Percentage width of views not respected
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Duplicate |
Resolution Date | 2012-03-05T11:24:07.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Android |
Labels | n/a |
Reporter | Paul Dowsett |
Assignee | Allen Yeung |
Created | 2011-04-15T03:43:18.000+0000 |
Updated | 2017-03-20T22:07:24.000+0000 |
Description
Note that although the title mentions widths and views, other dimensions and UI objects have not been tested. Thus, this issue _may_ extend to any UI object and any dimensions where percentages are used.
Behavior exhibited using:
* emulator
Android 2.2
Ti 1.6.0 and 1.6.1
Also tested on Samsung Galaxy S running 2.2.1, with same results.
With the following code (which will work in app.js without modification), although the percentage width of the view (set at a value of 90%) initially seems to work, if the orientation is toggled a couple of times, the width is changed to 90% of the _other_ orientation. In other words, when the orientation is portrait, the view is set to 90% of the landscape view, and vice versa.
var win1 = Ti.UI.createWindow({
backgroundColor:"white",
title:'win1'
});
var view = Ti.UI.createView({
backgroundColor: "green",
height:50,
width:"90%",
top:100
});
win1.add(view);
win1.open();
When the above bug has been resolved, please also check that it works for tabgroups, as per [http://developer.appcelerator.com/question/117316/percentage-width-still-doesnt-work]
The following code can be used to test this scenario:
var tabGroup = Ti.UI.createTabGroup();
var win1 = Ti.UI.createWindow({
title:'win1'
});
var tab1 = Ti.UI.createTab({
title:'tab1',
window:win1
});
var label1 = Ti.UI.createLabel({
text:'tab1'
});
win1.add(label1);
var win2 = Ti.UI.createWindow({
title:'win2'
});
var tab2 = Ti.UI.createTab({
title:'tab2',
window:win2
});
var view = Ti.UI.createView({
backgroundColor: "green",
height:50,
width:"90%",
top:100
});
win2.add(view);
tabGroup.addTab(tab1);
tabGroup.addTab(tab2);
tabGroup.open();
Added several of you for notifications to make sure we have tests for this.
Hi. If I may add one more issue related to the calculation of dimensions when defined as percentages: http://developer.appcelerator.com/question/116905/percentage-dimensions-in-nested-views
Closing ticket as duplicate.