amurcia
amurcia

Reputation: 791

Titanium - ScrollableView height on Android

I have a problem with the height of a scrollableView on Android.

I don't know what width and height have got the photos but I want that the width of the photo fill the screen so, width: Ti.UI.FILL, and the height be proportional. But the result is that the scrollableView fills the width but the photo is very very small in the center of the scrollable view. I need to maintain the proportionality of the image.

On iOS works perfectly, but on Android it's impossible,

I have a tableViewRow with a scrollableView inside:

        <TableViewRow id="sliderRow" height="Ti.UI.SIZE" width="Ti.UI.FILL">
                <ScrollableView id="slider" showPagingControl="true"></ScrollableView>
        </TableViewRow>

The tss of the slider is:

"#slider":{
    height: Titanium.UI.SIZE,
    width: Titanium.UI.FILL,
    top: 2,
    right: 2,
    left: 2
}

The code of the images that I add to the scrollableView:

    var image = Ti.UI.createImageView({
        id: ('image' + i),
        image: (raiz + path),
        height: Ti.UI.SIZE,
        width: Ti.UI.FILL,
        defaultImage: "/images/Principal/imagen_carga.png"  
    });

Upvotes: 0

Views: 395

Answers (2)

Fokke Zandbergen
Fokke Zandbergen

Reputation: 3866

This is a know parity bug, reported under:

https://jira.appcelerator.org/browse/TIMOB-16878

Upvotes: 1

Foxbox
Foxbox

Reputation: 129

(layout=vertical is a property of SCROLLview, but this is a SCROLLABLEview).

based on your description you have photos of different sizes that you want to present in a vertical row?

I can do this with eg like this:

View:

<ScrollView id="svIndex"  height="100%" layout="vertical"  ></ScrollView>

Controller:

   Image = Ti.UI.createImageView({ width: "100%", image: '/images/one.png' });
   $.svIndex.add(Image);

   Image = Ti.UI.createImageView({ width: "100%", image: '/images/two.png' });
   $.svIndex.add(Image);

   Image = Ti.UI.createImageView({ width: "100%", image: '/images/three.png' });
   $.svIndex.add(Image);

This results in unequal photo Heights (if the photo sizes are different)

HTH

Upvotes: 0

Related Questions