Problem:
I have a scrollView with a vertical layout and a bunch of views. Depending on the content, some of these views need to hide and the views after that one need to be repositioned.
Example code:
var win = Ti.UI.createWindow({backgroundColor:'black'});
var scrollView = Ti.UI.createScrollView({
layout:'vertical',
contentHeight:'auto',
top:0,bottom:0,left:0,right:0
});
win.add(scrollView);
win.open();
var len = 2;
for(var i = 0; i < len; i++){
scrollView.add(
Ti.UI.createView({
top:5,
left:20,
right:20,
backgroundColor:'white',
height:80
})
);
}
var magicView = Ti.UI.createView({
top:5,
left:30,
right:30,
backgroundColor:'red',
height:100
});
var viewThatWillGetPushedToTheTop = Ti.UI.createView({
top:5,
left:30,
right:30,
backgroundColor:'green',
height:100
});
scrollView.add(magicView);
scrollView.add(viewThatWillGetPushedToTheTop);
for(var i = 0; i < len; i++){
scrollView.add(
Ti.UI.createView({
top:5,
left:20,
right:20,
backgroundColor:'white',
height:80
})
)
}
scrollView.add(Ti.UI.createView({backgroundColor:'blue',height:100,top:10}))
setTimeout(function(){
magicView.hide();
viewThatWillGetPushedToTheTop.top -= magicView.height
},4000);
Explanation:
So, here we have a simple window with a scrollView. In the scrollView there are two white views, a red view, a green view, two more white views, and a blue one. After a 4 second timer, I remove the red view and push back the green view. When this happens, you'll see that the last view, the blue one (which is 100px height) will be cut off at the middle.
Tested with 2.0.1GA2 on a Samsung Galaxy S2 and I'm unable to reproduce this issue. Ticket closed.
Verified fixed on Tested on: Titanium SDK: 2.2.0.v20120716092112 Titanium Studio, build: 2.1.1.201207121732 and device Android 3.2
Re-opening to edit label