Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8928] Android: scrollView might not scroll changing device orientation

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionCannot Reproduce
Resolution Date2012-05-01T07:50:57.000+0000
Affected Version/sRelease 2.1.0
Fix Version/sn/a
ComponentsAndroid
LabelsSupportTeam, api, regression
ReporterFederico Casali
AssigneePing Wang
Created2012-04-30T10:38:30.000+0000
Updated2017-03-10T00:05:48.000+0000

Description

Problem description

Changing orientation, scrollView vertical scroll might not work, depending on height property

Steps to reproduce and sample code

- Create a scrollView and add objects to it - Be sure the scrollView height it's lower than the screen height in portrait (so it's not scrolling in portrait mode) but higher than screen height in landscape (where it should scroll) Result: when turned to landscape, scrollView it's not scrolling. This is reproducible only with latest 2.1 master SDK. See attached code below. Please note that changing 'stmtView' view height to a fixed number (for example 450) then the issue it's not reproducible and scrollView scroll down as expected.
var win = Ti.UI.createWindow({
	backgroundColor:'white',
	title:'test'
});

win.orientationModes=[
		Titanium.UI.PORTRAIT,
 		Titanium.UI.LANDSCAPE_LEFT,
 		Titanium.UI.LANDSCAPE_RIGHT
 	];


	var view = Ti.UI.createView({
		height:205,
		backgroundColor:'green',
		top:0
	});

	win.add(view);

	
	
	var stmtScrollView = Ti.UI.createScrollView({
			contentWidth : 'auto',
			// contentHeight : 'auto',
			top : 0,
			showVerticalScrollIndicator : true,
			showHorizontalScrollIndicator : false//true
		});
	var stmtView = Ti.UI.createView({
			top : 0,
			bottom : 20,
			height : Ti.UI.SIZE, //450, // setting a fixed number, like 450, scrollView scroll fine in landscape
			backgroundColor:'gray',
			left : 0,
			right : 0,
			//width:'100%',
			layout : 'vertical'
		});
	stmtView.top = view.height;
	var subNavViewSectionTitleLabel = Titanium.UI.createLabel({
			top : 20,
			height : 'auto',
			left : '5%',
			right : '3.1%',
			color : '#363636',
			text : 'Test scrollView scroll',
			font : {
				fontfamily : 'Helvetica Neue',
				fontSize : 20,
				fontWeight : 'bold'
			}
		});
	var callBtn = Ti.UI.createButton({
				top : 50,
				left : '5%',
				height : 260,
				right : '4.1%',
				title : 'Red button',
				visible : true,
				backgroundColor : 'red',
				borderRadius : 8,
				font : {
					fontSize : 19,
					fontWeight : 'bold',
					fontFamily : 'Helvetica Neue'
				},
				color : '#FFFFFF'
			});
	

	stmtView.add(subNavViewSectionTitleLabel);
	stmtView.add(callBtn);
	stmtScrollView.add(stmtView)
	win.add(stmtScrollView);
	
	win.open();

Comments

  1. Ping Wang 2012-05-01

    Can not reproduce with latest master on HTC Sensation (2.3.4).
  2. Lee Morris 2017-03-10

    Closing this ticket as the issue cannot be reproduced.

JSON Source