Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9634] Android: View changes size after device rotation

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionCannot Reproduce
Resolution Date2020-01-09T22:12:07.000+0000
Affected Version/sRelease 2.1.0, Release 3.1.0
Fix Version/sn/a
ComponentsAndroid
Labelsapi, qe-and060112, usability
ReporterOlga Romero
AssigneeUnknown
Created2012-06-19T10:52:52.000+0000
Updated2020-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

FileDateSize
LayoutChange1.png2012-06-19T10:52:52.000+000020230
layutChange.png2012-06-19T10:52:52.000+000021602

Comments

  1. Shameer Jan 2013-03-07

    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.

JSON Source