Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Fill ImageView with image proportionally

$
0
0

Hi all,

I'm working on an app with a couple image galleries for a client. It's been working fine on iOS for quite a while, but we're now porting it to Android. The image galleries consist of a ScrollableView that contains ScrollViews for each image in the gallery. Each ScrollView in turn contains an ImageView.

Running on iOS, this code makes the image fill the ImageView to 100% width or height, depending on the aspect ratio of the image:

var view = Ti.UI.createImageView({
            image: "http://a-domain.com/some/path/some_image.png",
            defaultImage: av.settings.defaultImage,            
            left: 0,
            top: 0,
            bottom: 0,
            right: 0                       
});
However this isn't working on Android. I've tried a bunch of different values for dimensions and placement, but haven't found anything that works quite right.

To hopefully make it clear how I need images to display: In the case of a wide image, it should fill the available width, while retaining its original proportions. Similarly, a tall image should fill the available height.

Thanks for any help!

Gabe


Viewing all articles
Browse latest Browse all 8068

Trending Articles