简体   繁体   English

Titanium ScrollView不会从左向右滚动

[英]Titanium ScrollView does not scroll left to right

I am building an app on Titanium. 我正在使用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! 谢谢!

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. 在合金xml文件中使用它,并使用add方法从合金xml或js文件添加视图。

i added scrollview properties 我添加了scrollview属性

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

and it works fine now. 它现在工作正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM