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

Android: ListView 'canScroll' property cannot be set dynamically

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: Release 6.0.0
    • Fix Version/s: Release 7.0.2
    • Component/s: Android
    • Labels:
    • Environment:

      Xcode 9.2
      macOS High Sierra
      SDK: faulty behavior present on both 6.3.0.GA+

    • Story Points:
      1

      Description

      The 'canScroll' property on ListView for Android cannot be dynamically set. It has been implemented as a creation-only property. Please introduce a dynamic capability to run listView.setCanScroll(false); in android. This works correctly in iOS already.

      Test case:

      var win = Ti.UI.createWindow({backgroundColor: 'black'});
       
      var canScroll = true;
       
      var listView = Ti.UI.createListView({
      	top: 200
      });
      Ti.API.info("status", " canScroll " + listView.getCanScroll());
      var sections = [];
       
      var button  = Ti.UI.createButton({title: "toggle", top: 3});
      win.add(button);
      button.addEventListener('click', function(){
      	Ti.API.info("status", " canScroll " + listView.getCanScroll());
      	canScroll = !canScroll;
      	listView.setCanScroll(canScroll);
      	Ti.API.info("status", " canScroll " + listView.getCanScroll());
      });
       
      var fruitSection = Ti.UI.createListSection({headerTitle: 'Fruits', canScroll: false});
      var fruitDataSet = [
      	{properties: {title: 'Apple'}},
      	{properties: {title: 'Banana'}}
      ];
      fruitSection.setItems(fruitDataSet);
      sections.push(fruitSection);
       
      var vegSection = Ti.UI.createListSection({headerTitle: 'Vegetables'});
      var vegDataSet = [
      	{properties: {title: 'Carrots'}},
      	{properties: {title: 'Potatoes'}},
      	{properties: {title: 'Potatoes'}},
      	{properties: {title: 'Potatoes'}},
      	{properties: {title: 'Potatoes'}},
      	{properties: {title: 'Potatoes'}},
      	{properties: {title: 'Potatoes'}},
      	{properties: {title: 'Potatoes'}},
      	{properties: {title: 'Potatoes'}},
      	{properties: {title: 'Potatoes'}},
      	{properties: {title: 'Potatoes'}},
      	{properties: {title: 'Potatoes'}},
      	{properties: {title: 'Potatoes'}},
      	{properties: {title: 'Potatoes'}},
      	{properties: {title: 'Potatoes'}},
      	{properties: {title: 'Potatoes'}},
      	{properties: {title: 'Potatoes'}},
      	{properties: {title: 'Potatoes'}},
      	{properties: {title: 'Potatoes'}}
      ];
      vegSection.setItems(vegDataSet);
      sections.push(vegSection);
       
      listView.sections = sections;
      win.add(listView);
      win.open();
       
      var fishSection = Ti.UI.createListSection({headerTitle: 'Fish'});
      var fishDataSet = [
      	{properties: {title: 'Cod'}},
      	{properties: {title: 'Haddock'}}
      ];
      fishSection.setItems(fishDataSet);
      listView.appendSection(fishSection);
      

        Attachments

          Activity

            People

            • Assignee:
              jquick Joshua Quick
              Reporter:
              cornflakesuperstar Jason Kotchoff
              Reviewer:
              Gary Mathews
              Tester:
              Lokesh Choudhary
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

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

                  Git Source Code