Titanium ScrollView不会从左向右滚动

时间:2014-04-03 07:20:07

标签: javascript android ios titanium titanium-alloy

我正在使用Titanium构建应用程序。好吧,我们想要滚动视图从左向右滚动,反之亦然。

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

但它并没有这样做。最后一个视图(因为它不再适合)下降。我该如何实现这一权利?是否设置了所有视图需要并排放置的设置?我也试图把它放在一个视图上但仍然无法工作。

我们将不胜感激。谢谢!

2 个答案:

答案 0 :(得分:2)

这对我有用:

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

在合金xml文件中使用它,并使用add方法从合金xml或js文件添加视图。

答案 1 :(得分:0)

我添加了scrollview属性

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

现在工作正常。

相关问题