Search code examples
javascriptandroidiostitaniumtitanium-alloy

Titanium ScrollView does not scroll left to right


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!


Solution

  • 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.