There may be a simple solution to this. But for some reason, I'm not able to display an image inside a container, so that it fills the entire width of the container and preserve the aspect ratio. This is what I have now:
var imageView = Ti.UI.createImageView({ image: 'http://some-url/image.jpg', width: Ti.UI.FILL, top: 0 }); var imageScrollView = Ti.UI.createScrollView({ scrollingEnabled: true, scrollType: 'vertical', contentWidth: Ti.UI.FILL, width: 200, height: 200, top: 0 }); imageScrollView.add(imageView); win.add(imageScrollView);Ideally, the image would scroll vertically inside the container, but if it doesn't, it's OK too (the bottom portion will be cut off, or there will be an empty space). The container is square.
Now, if an image is of the landscape type, it displays correctly. However, if an image is a portrait (higher than wider) and the app runs on an Android device, there are distinct empty spaces on the left and right of the image, i.e. the width of the container is not filled. The same behavior occurs in the default Android emulator WVGA800. On an iPhone, the snippet works correctly. Is there any way to fill the width of the container?