Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9802] Android: ScrollView - ScrollView scrolls horizontally when manually set to vertical layout

GitHub Issuen/a
TypeBug
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 2.1.0
Fix Version/sn/a
ComponentsAndroid
Labelscore, qe-and060112, reprod
ReporterShyam Bhadauria
AssigneeUnknown
Created2012-06-26T05:12:24.000+0000
Updated2018-02-28T20:03:29.000+0000

Description

This is a regression.Was not occuring in 2.0.2. Details: If the scrollView.width and scrollView.height are manually set to a vertical layout i.e. do not use the layout property, vertical scrollView will not scroll. Steps to reproduce: 1. Launch code in app.js:
var win = Titanium.UI.createWindow({  
    layout:'vertical',
    backgroundColor:'#fff'
});
 
var scrollView = Ti.UI.createScrollView({
    showHorizontalScrollIndicator:true, showVerticalScrollIndicator:true,
    width: 250, height: 100, top: 50,
    borderColor:'green', borderWidth:1,
    contentWidth:1000, contentHeight:100
});
 
for(var i=0; i<10; i++) {
    for(var j=0; j<10; j++) {
        scrollView.add(Ti.UI.createLabel({
            top:i*100, left:j*100,
            width:100, height:100,
            text:i+':'+j, textAlign:'center',
            color:'white',
            backgroundColor:'#A0' + Number(i%2*8).toString(16) +'0'+ Number(8-j%2*8).toString(16)+'0',
            borderColor:'black', borderWidth:1 
        }));
    }
}
 
var button = Ti.UI.createButton({title:'Flip', width:100, height:50});
button.addEventListener('click', function() {
        // bug is here
    scrollView.width = 100;
    scrollView.height = 250;
     
    scrollView.contentWidth = 100;
    scrollView.contentHeight = 1000;
 
    button.title = 'Click again';
     
});
 
scrollView.addEventListener('scroll', function() {
    //Ti.API.info('Offset: (' + scrollView.contentOffset.x + ', ' + scrollView.contentOffset.y + ')');
});
win.add(scrollView);
win.add(button);
win.open();
2. Press Flip 3. Try scrolling Actual: ScrollView will not scroll vertically, but is will scroll horizontally. Expected: Should be able to scroll vertically and not horizontally.

Comments

  1. Payminder Singh 2012-06-26

    Titanium Studio: 2.1.0.201206251749 Mobile SDK: 2.1.0.v20120626074155 OS: X Lion Device: Android Emulator, Samsung Nexus S. Reproducible Unable to scroll vertically.
  2. Allen Yeung 2012-06-26

    I tried 2.0.2 and 2.0.1, and I was not able to scroll vertically on older versions either.
  3. Eric Merriman 2012-06-26

    My notes: tried this without the vertical layout property, this caused no change in behavior, so not a factor. Tried this test with 2.0.2 on Droid 3 and Galaxy Tab 10.1. The result was that after the "flip" button is clicked, the scrollview could not scroll either horizontal or vertical. This shows that this is not a regression.
  4. Eric Merriman 2012-06-26

    According to Max, Android allows only one scroll direction.
  5. Lee Morris 2017-07-11

    I am able to reproduce this issue with the following environment; Pixel (7.1) Studio 4.9.0.201705302345 Ti SDK 6.1.1 GA Appc NPM 4.2.9 Appc CLI 6.2.2 Ti CLI 5.0.14 Alloy 1.9.11 Xcode 8.2 (8C38) Node v4.8.2 Java 1.8.0_131

JSON Source