[TIMOB-9634] Android: View changes size after device rotation
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Low |
| Status | Closed |
| Resolution | Cannot Reproduce |
| Resolution Date | 2020-01-09T22:12:07.000+0000 |
| Affected Version/s | Release 2.1.0, Release 3.1.0 |
| Fix Version/s | n/a |
| Components | Android |
| Labels | api, qe-and060112, usability |
| Reporter | Olga Romero |
| Assignee | Unknown |
| Created | 2012-06-19T10:52:52.000+0000 |
| Updated | 2020-01-09T22:12:07.000+0000 |
Description
Description:
The red square changes it's size after the "Start" button pressed and the device is rotated.
Not a regression, occurs in 2.0.2 as well.
Steps to reproduce:
1. Run an attached code
var win = Ti.UI.currentWindow;
win.backgroundColor = 'white';
var buttonStart = Ti.UI.createButton({
title: 'Start',
top: 20,
height: Ti.UI.SIZE,
width: Ti.UI.SIZE
});
var buttonFinish = Ti.UI.createButton({
title: 'Finish',
top: 140,
height: Ti.UI.SIZE,
width: Ti.UI.SIZE
});
var buttonUpdate = Ti.UI.createButton({
title: 'Update',
top: 260,
height: Ti.UI.SIZE,
width: Ti.UI.SIZE
});
buttonStart.addEventListener('click', function()
{
view.startLayout();
view.width = 75;
view.height = 75;
// view.backgroundColor = 'blue'; will not be affected by startLayout/finishLayout; not a layout parameter
});
buttonFinish.addEventListener('click', function()
{
view.finishLayout();
});
buttonUpdate.addEventListener('click', function()
{
view.updateLayout({
// backgroundColor: 'yellow', will not be affected by updateLayout; not a layout parameter
height: 100,
width:100
});
});
var view = Ti.UI.createView({
backgroundColor: 'red',
height: 50,
width: 50,
top: 330
})
win.add(buttonStart);
win.add(buttonFinish);
win.add(buttonUpdate);
win.add(view);
2. Press Start button
4. Rotate the device
Actual result:
The red square has a different size.
Expected results:
Red square should stay the same size.
Attachments
| File | Date | Size |
|---|---|---|
| LayoutChange1.png | 2012-06-19T10:52:52.000+0000 | 20230 |
| layutChange.png | 2012-06-19T10:52:52.000+0000 | 21602 |
I cannot reproduce output ,it shows "Runtime error".But when i replace "currentWindow" to "createWindow" it shows some output. 1.Press Start button 2.Rotate the device red square changes its size according to the buttonStart.addEventListener('click', function() { view.startLayout(); view.width = 75; view.height = 75; }); But red square changes its size only when rotation takes place (either landscape or portrait), it seems that its a bug.