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

Android : Scrollview with a tableview does not scroll if contentHeight is set to 'auto'

    Details

    • Story Points:
      3
    • Sprint:
      2017 Sprint 20 SDK, 2017 Sprint 21 SDK

      Description

      Run the below code snippet to see scrollview with a tableview inside not scrolling if contentHeight is set to 'auto'. It works fine if it is set to 500 or 1000. But works fine in ios with 'auto'.

      var win = Ti.UI.createWindow({
          backgroundColor:'gray',
          layout:'vertical'
      });
       
      var someLabel = Ti.UI.createLabel({
          text: 'some content'
      })
       
      win.add(someLabel);
       
      var testArray = new Array('1','2','3','4','5','6','7','8','9','10');
       
      var cardScrollView = Ti.UI.createScrollView({
              layout:'vertical',
              contentHeight:'auto', // 500 or 1000 works
              contentWidth:'auto',
              height: '100%',
              width:'100%',
              top:0,
              scrollType:'vertical'
      });
       
      cardScrollView.addEventListener('scroll', function(e){
          
         Ti.API.info('Scroll called from scrollview'); 
      });
      var table_view = Ti.UI.createTableView({
              //top: 350,
              id: 'mytable',
              scrollable: false,
              touchEnabled:false,
              className: "row",
              backgroundColor:'white',
              separatorColor:'black',
              height: Ti.UI.SIZE
      });
       
      table_view.addEventListener('scroll', function(e){
          
         Ti.API.info('Scroll called from tableview'); 
      });
      var data = [];
      for(var i=0;i<testArray.length;i++)
      {
          var row = Ti.UI.createTableViewRow({
              title:testArray[i], color: "black"
          });
          
          data[i] = row;
      }
       
      table_view.setData(data);
       
      cardScrollView.add(table_view);
       
      win.add(cardScrollView);
      win.open();
      

        Attachments

          Activity

            People

            • Assignee:
              jquick Joshua Quick
              Reporter:
              anagesh Anirudh Nagesh
              Reviewer:
              Gary Mathews
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

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

                  Git Source Code