Reputation: 26854
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!
Upvotes: 0
Views: 716
Reputation: 9287
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.
Upvotes: 2
Reputation: 26854
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.
Upvotes: 0