[TIMOB-8891] Android: scrollView not scrolling if contentHeight = 'auto'
| GitHub Issue | n/a | 
|---|---|
| Type | Bug | 
| Priority | Critical | 
| Status | Closed | 
| Resolution | Fixed | 
| Resolution Date | 2012-07-04T03:07:49.000+0000 | 
| Affected Version/s | Release 2.1.0 | 
| Fix Version/s | Release 2.1.0, Sprint 2012-09 Core | 
| Components | Android | 
| Labels | core, module_scrollview, qe-testadded | 
| Reporter | Jon Alter | 
| Assignee | Allen Yeung | 
| Created | 2012-04-25T15:31:20.000+0000 | 
| Updated | 2012-07-16T23:42:54.000+0000 | 
Description
	scrollView not scrolling if contentHeight = 'auto' and height of the childView of scrollView is set to SIZE.
It works fine if you set the height of the childView to something static instead of SIZE
Steps to repro
Step 1: run code Step 2: try to scroll (if it doesn't scroll then it is still broken)
var win = Ti.UI.createWindow();
win.open();
var scrollView = Ti.UI.createScrollView({
	contentHeight:'auto',
	backgroundColor: 'green'
});
win.add(scrollView);
var innerView = Ti.UI.createView({
	height:Ti.UI.SIZE, // works if set to 1000
	layout:'vertical',
	left:0,
	top:0,
	right:0
});
scrollView.add(innerView);
var colors = ['red', 'blue', 'pink', 'white', 'black'];
var max = 10;
for(var i = 0; i < max; i++){
	innerView.add(Ti.UI.createView({
		backgroundColor: colors[i%colors.length],
		height: 100,
		top: 20
	}));
}
Tested with Droid 3 2.3.4 with 2.1.0.v20120615104152
Reopening to update labels.
I think commit [76a526da112a1a478e0ac3d78a80e5379b0a06be](https://github.com/appcelerator/titanium_mobile/commit/76a526da112a1a478e0ac3d78a80e5379b0a06be) broke it It s not working anymore.
This seems to be working for me. Can you please try the latest version of the sdk?
Verified the example above works fine on current master and 2_1_X branch.
Ok so it still didnt work for me because i was not using the innerView. SO this would be my example which doesnt work ( works on iphone by the way). Remark the horizontal layout which is very important for me.
var win = Ti.UI.createWindow(); win.open(); var scrollView = Ti.UI.createScrollView({ contentHeight:'auto', contentWidth:0, layout:'horizontal', backgroundColor: 'green' }); win.add(scrollView); var colors = ['red', 'blue', 'pink', 'white', 'black']; var max = 120; for(var i = 0; i < max; i++){ scrollView.add(Ti.UI.createView({ backgroundColor: colors[i%colors.length], height: 100, left: 10, width: 100, top: 10 })); }var win = Ti.UI.createWindow(); win.open(); var scrollView = Ti.UI.createScrollView({ contentHeight:'auto', contentWidth:0, backgroundColor: 'green' }); win.add(scrollView); var innerView = Ti.UI.createView({ height:Ti.UI.SIZE, // works if set to 1000 layout:'horizontal', left:0, top:0, right:0 }); scrollView.add(innerView); var colors = ['red', 'blue', 'pink', 'white', 'black']; var max = 120; for(var i = 0; i < max; i++){ innerView.add(Ti.UI.createView({ backgroundColor: colors[i%colors.length], height: 100, left: 10, width: 100, top: 10 })); }Thanks a lot Allen!