Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-9802

Android: ScrollView - ScrollView scrolls horizontally when manually set to vertical layout

    Details

    • Type: Bug
    • Status: Open
    • Priority: Low
    • Resolution: Unresolved
    • Affects Version/s: Release 2.1.0
    • Fix Version/s: None
    • Component/s: Android
    • Environment:

      Tested with Titanium SDK: 2.1.0.v20120625134154
      Tested with Titanium  Studio: 2.1.0.201206221045
      Device - Android 2.2.2 LG-P970,Samung GALAXY Tab 620 Android 3.2
      Machine OS - MAC 10.7.3

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                sbhadauria Shyam Bhadauria
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-13923
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Source Code