Domanda

I am building an app on Titanium. Well the idea is we want the scrollview to scroll from left to right or vice versa.

    <ScrollView id="svForm" backgroundColor="green" top="10" width="100%" height="200"
        scrollType = "horizontal" layout="horizontal" >

            <View width="23%" height="90%" top="0" borderColor="#FFFFFF" borderWidth="1" backgroundColor="brown">
                <Label>
                    1 
                </Label>
            </View>
            <View width="23%" height="90%" top="0" borderColor="#FFFFFF" borderWidth="1" backgroundColor="orange">
                <Label>
                    2 
                </Label>
            </View>
            <View width="23%" height="90%" top="0" borderColor="#FFFFFF" borderWidth="1" backgroundColor="yellow">
                <Label>
                    3
                </Label>
            </View>
            <View width="50%" height="90%" top="0" borderColor="#FFFFFF" borderWidth="1" backgroundColor="blue">
                <Label>
                    4
                </Label>
            </View>

    </ScrollView>

But it doesn't do that. the last view (since it doesnt fit anymore) goes down. How can i implement this right? Is there a setting to be set that all the views need to sit side by side? I also tried to put this on a view and still dont work.

Your help will be appreciated. Thanks!

È stato utile?

Soluzione 2

i added scrollview properties

<ScrollView id="svForm" backgroundColor="green" top="10" height="200"
scrollType = "horizontal" 
contentWidth =  'auto'
contentHeight = 'auto'
showVerticalScrollIndicator = "true"
showHorizontalScrollIndicator = "true">

and it works fine now.

Altri suggerimenti

This works for me:

<ScrollView id="svImage" height="Ti.UI.SIZE" width="Ti.UI.FILL" scrollType = "horizontal" layout="horizontal"></ScrollView>

Use this in alloy xml file and add views from alloy xml or from js file using add method.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top