Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

window height is undefined

Hi,
I'm trying to access the height of a window through the property "height". I got the window from Ti.UI.currentWindow . I don't think that it's supposed to be undefined or is it? Anybody experiencing the same? My SDK version is 1.2.1.
Greetings…

— asked April 8th 2010 by Karl Bode
  • height
  • mobile
  • window
0 Comments

3 Answers

  • Ti.UI.currentWindow.size.height
    and
    Ti.UI.currentWindow.size.width
    should both work.

    — answered April 8th 2010 by Mark Burggraf
    permalink
    3 Comments
    • I tried this and I keep getting either undefined or nan. Neither
      Ti.UI.currentWindow.size.height or Ti.UI.currentWindow.height works?

      — commented August 5th 2010 by De Wet Steynberg
    • I think width/height/size only works on iPhone. It doesn't work on my Android.

      — commented August 24th 2011 by Simon Strandgaard
    • No, "size" works on Android also. The thing is that dimensions are calculated when window opens, so you need to listen to the window open event and then get size.(widht|height).

      — commented August 24th 2011 by Ivan Škugor
  • i'm not exactly sure, but i think for all kinds of views there is a property "size", which consists of x and y, that holds the width and height of the element

    — answered April 8th 2010 by Christian Sigl
    permalink
    1 Comment
    • This doesn't work for me on Android.

      — commented August 24th 2011 by Simon Strandgaard
  • Yeah, I figured this out by now too. Thanks for your help though….

    — answered April 8th 2010 by Karl Bode
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.