Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-3178] Android: Window dimensions unavailable directly after opening

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionInvalid
Resolution Date2014-01-07T22:34:33.000+0000
Affected Version/sRelease 3.0.0
Fix Version/sn/a
ComponentsAndroid
Labelsapi
ReporterBill Dawson
AssigneeBiju pm
Created2011-04-15T03:38:52.000+0000
Updated2017-03-20T18:04:17.000+0000

Description

The following code used to work (1.5.X):

var win =Ti.UI.createWindow({backgroundColor:'black'});
win.open();
var width = win.width;  // Returns 0 since 1.6, used to work in 1.5

Comments

  1. Junaid Younus 2012-08-31

    Tested on a Samsung Galaxy S2 using TiSDK 2.2.0v20120830102513, issue still valid.
       var win = Ti.UI.createWindow({backgroundColor: 'white'});
       
       win.addEventListener('click', function(e)
       {
           alert('width: ' + win.width);
       });
       
       win.open();
       
  2. Biju pm 2013-12-30

    PR :- https://github.com/appcelerator/titanium_mobile/pull/5171
  3. Hieu Pham 2014-01-07

    There's already a size property that does this. Simply use win.size.width or win.size.height to retrieve the width and height of the window.
  4. Lee Morris 2017-03-20

    Closing ticket as invalid.

JSON Source