i've a scrollView and i add dynamically a number of views to it and the result should be like this:
As the shown scrollview contains only 2 views so normally the scroll is disabled on it as their total height is less than the scrollView height (if there are 3 or 4 views so the scroll will start to be enabled).
but often i get a result like this : bad view hight img
As it's shown , the view are stretched and as there are 2 views only so the scroll remains disabled even now the apparent height is greater than the scrollView height.
the following is the code for adding views to the scrollView : (views are the scrollVviews[i] variables which will be added to the $.scrollView.scrollViewCont view and $.scrollView.scrollViewCont will be finally added to the $.scrollView : creating views is make dynamically inside a for loop)
$.scrollView.scrollViewCont = Ti.UI.createView({ id : "scrollViewCont", width:Ti.UI.SIZE, height:'100%', visible:false }); for (var i = 0; i < UrlsArray.length; i++) { scrollVviews[i] = Titanium.UI.createView({ id : "ScrollVview"+i, width : "100%", height : '100dp', top : i * 110, nightid : UrlsArray[i][0], }); var numlabel = Ti.UI.createLabel({ id : "numlabel"+i, font : { fontSize : '70sp' }, color : "#C29531", text : i + 1, left : '12.121212121212121%' // 8 de 66 }); if(i > 8){ numlabel.setLeft('1.5151515151515151%'); // 1 de 66 numlabel.setFont({ fontSize : '45sp' }); } var numbackgndview = Ti.UI.createView({ id : "numBgrndView"+i, top : 0, left : 0, width : '20.625%', // 66 de 320 height : "100%", borderColor : "#C29531", borderWidth : 0.5, backgroundColor:"rgba(0,0,0,0.5)" }); numbackgndview.add(numlabel); scrollVviews[i].add(numbackgndview); if(UrlsArray[i][0] != "x") scrollVviews[i].add(ImageView); else { scrollVviews[i].add(imgviewWrapper); imgviewWrapper = null; } $.scrollView.scrollViewCont.add(scrollVviews[i]); scrollViAC++; //scrollVview = null; }//END OF FOR LOOP $.scrollView.add($.scrollView.scrollViewCont);
and the scrollView style is :
"#scrollView":{ top:'10.48951048951049%', height:'48%', // 164 de 286 width:"98%", left:'1%' }