[TIMOB-19985] Android - ListView doesn't have canScroll property
| GitHub Issue | n/a |
|---|---|
| Type | Improvement |
| Priority | Low |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2016-12-02T16:18:09.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | Release 6.1.0 |
| Components | Android |
| Labels | Community, listview |
| Reporter | Shawn Lan |
| Assignee | Farzad Merzadyan |
| Created | 2015-07-18T00:08:57.000+0000 |
| Updated | 2017-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.
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.
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.
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);Verified the fix.
canScrollproperty 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.1PixelVerified the improvement
canScrollcan 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.*