Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19985] Android - ListView doesn't have canScroll property

GitHub Issuen/a
TypeImprovement
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2016-12-02T16:18:09.000+0000
Affected Version/sn/a
Fix Version/sRelease 6.1.0
ComponentsAndroid
LabelsCommunity, listview
ReporterShawn Lan
AssigneeFarzad Merzadyan
Created2015-07-18T00:08:57.000+0000
Updated2017-07-25T18:53:20.000+0000

Description

It seems I can't disable scrolling for a ListView on Android, or disable its overscroll effect (similar to overScrollMode for a ScrollView). For iOS, I can simly set "canScroll" to false. Please add this feature to Android as well. Thanks.

Comments

  1. Amimul Hossain 2015-09-13

    Hello [~shawnlan], you can use "touchEnabled = false" for Android to disable ListView scroll. But, remember it will make you lose the itemclick event possibility. Thanks.
  2. Shawn Lan 2015-09-14

    I will need itemclick event. Most people will need it as well. Please add the canScroll to Android. I don't see a reason why it's on iOS but not on Android. Thanks.
  3. Farzad Merzadyan 2016-11-09

    PR: https://github.com/appcelerator/titanium_mobile/pull/8593 App.js:
       var win = Ti.UI.createWindow({backgroundColor: 'black'});
       var listView = Ti.UI.createListView({
       	canScroll: false
       });
       Ti.API.info("status", " canScroll " + listView.getCanScroll());
       listView.setCanScroll(false);
       Ti.API.info("status", " canScroll " + listView.getCanScroll());
       var sections = [];
       
       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);
       
       
  4. Lokesh Choudhary 2016-12-02

    Verified the fix. canScroll property works as expected. Closing. Appc Studio : 4.8.1.201611291132 SDK Version : 6.1.0.v20161202104721 Mac OS Version : 10.12 Xcode Version : Xcode 8.1 Build version 8B62 Appc CLI AND Appc NPM : {"NPM":"4.2.9-1","CLI":"6.1.0-302"} Ti CLI : 5.0.11 Alloy : 1.9.4 Node : v4.6.0 Device: running 7.1Pixel
  5. Josh Longton 2016-12-02

    Verified the improvement canScroll can now be set. Tested on: {noformat} macOS Sierra 10.12.1 Nexus 5X(6.0.1) Nexus 6p (7.0) android emulator (4.4.2, 6.0) Studio: 4.8.0.201611121409 Ti SDK: 6.1.0.v20161202081834 Appc NPM: 4.2.8 App CLI: 6.1.0-302 Node v4.4.7 {noformat} *Closing Ticket.*

JSON Source