vertical createScrollableView
Is this possible to do?
Now it only is horizontal can i make it scroll vertical?
Regards
6 Answers
-
Any suggestions?
-
That isn't possible with the scrollable view, but you can use views and swipe gestures to approximate the effect.
-
this is how i did it
<script src='http://pastie.org/1196140.js'></script>
i just made the height of the scrollableview pretty long to force it to scroll
but i am still new and there is probably as always a better way
-
This should work. The key is to add "layout:'vertical'". Cheers John.
var win = Ti.UI.currentWindow; var scrollView = Titanium.UI.createScrollView ({ contentWidth:'auto', contentHeight:'auto', showVerticalScrollIndicator:true, layout:'vertical' }); var content = Ti.UI.createLabel ({ text:'This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. This text will scroll vertially. ', font:{fontWeight:'bold', fontSize:14}, color: '#8c0000', height: 'auto', left: 10, top:10 }); scrollView.add(content); var content2 = Ti.UI.createLabel ({ text:'Another label.', font:{fontSize:14}, height: 'auto', left: 10, top:10 }); scrollView.add(content2); Titanium.UI.currentWindow.add(scrollView);
-
var view1 = Ti.UI.createView({
backgroundColor:'red',
left:0,
right:0,
top:0,
bottom:0
// transform:Ti.UI.create2DMatrix().rotate(90)
});
var l1 = Ti.UI.createLabel({
text:'View 1',
color:'#fff',
width:'auto',
height:'auto'
});
view1.add(l1);var view2 = Ti.UI.createView({ backgroundColor:'blue', left:0, right:0, top:0, bottom:0 // transform:Ti.UI.create2DMatrix().rotate(90) }); var l2 = Ti.UI.createLabel({ text:'Click Me (View 2 - see log)', color:'#fff', width:'auto', height:'auto' }); view2.add(l2); var view3 = Ti.UI.createView({ backgroundColor:'green', left:0, right:0, top:0, bottom:0 }); var l3 = Ti.UI.createLabel({ text:'View 3', color:'#fff', width:'auto', height:'auto' }); view3.add(l3); var view4 = Ti.UI.createView({ backgroundColor:'black', left:0, right:0, top:0, bottom:0 }); var l4 = Ti.UI.createLabel({ text:'View 4', color:'#fff', width:'auto', height:'auto' }); view4.add(l4); var button2 = Titanium.UI.createButton({ title:'Rotate Scrollableview', width:300, height:30, background:'transparent', bottom:0, left:0 //bottom:20 }); button2.addEventListener("click",function(e){ var t1 = Ti.UI.create2DMatrix().rotate(90); var t2 = Ti.UI.create2DMatrix().rotate(270); scrollView.transform = t1; for(i=0; i < scrollView.views.length ; i++){ scrollView.views[i].transform = t2; } }); win1.add(button2); var scrollView = Titanium.UI.createScrollableView({ views:[view1,view2,view3,view4], showPagingControl:true, pagingControlHeight:30, maxZoomScale:2.0, top:0, height:200, width:300, currentPage:1 }); win1.add(scrollView);
-
scrollType: 'vertical',