Titanium Community Questions & Answer Archive

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

image aspect ratio on orientation change

Hi,

I built a photo gallery using a ScrollableView containing ImageViews. When orientation changes, I need to resize all ImageViews to fit the screen.

I tried to use setWidth/setHeight in an "orientationchange" event listener but it has no effect unless I call setImage again. But then I ran into performance problems, sometimes the app crashes.

Anybody an idea what's the best approach?

— asked October 19th 2010 by Oliver Gruber
  • aspect
  • imageview
  • orientation
  • ratio
0 Comments

2 Answers

  • Check the screenCap.height and screenCap.Width and adjust view accordingly

    — answered October 19th 2010 by Duncan Kabinu
    permalink
    2 Comments
    • The view is adjusted automatically, but the image inside the view is not being resized. The only way is to set the image again. But this is no solution as the remote image has to be downloaded again.

      Any other solutions?

      — commented October 27th 2010 by Oliver Gruber
    • Adjust the size of the ScrollableView instead of the images.

      — commented February 23rd 2011 by Lyndon Hook
  • Ok I got same issue, answer is very simple, in the scrollable set width and height to '100%' var scrollable = Ti.UI.crateScrollableView({width:'100%', height:'100%'}); this will make the trick

    — answered April 2nd 2012 by Aldo Infanzon
    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.