user3281831
user3281831

Reputation: 909

How to stretch image in android appcelerator app to full width, but keep aspect ratio?

So I'm trying to view image in appcelerator android app, but I always get either image that fills whole screen, or image that has right aspect ration, but is not stretched to full width.

This code should show image stretched to full width, but keep aspect ratio, but it does not.

        var designView = Ti.UI.createView({
        width:Ti.UI.FILL,
        backgroundColor:"#042D40"
    });

Upvotes: 0

Views: 467

Answers (1)

Rene Pot
Rene Pot

Reputation: 24815

You should set the height too!

var designView = Ti.UI.createView({
    width:Ti.UI.FILL,
    height: Ti.UI.SIZE,
    backgroundColor:"#042D40"
});

Also, you should use ImageView for an image. So use the same size properties for the ImageView

Upvotes: 1

Related Questions