[TIMOB-17621] Android: Android ListView setDividerHeight is not exposed in Titanium
| GitHub Issue | n/a |
|---|---|
| Type | Improvement |
| Priority | None |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2015-04-28T04:21:06.000+0000 |
| Affected Version/s | Release 3.3.0 |
| Fix Version/s | n/a |
| Components | Android |
| Labels | TCSupport, android, defect |
| Reporter | Rene Pot |
| Assignee | Hieu Pham |
| Created | 2014-08-14T12:35:43.000+0000 |
| Updated | 2017-03-31T22:20:09.000+0000 |
Description
There is a native functionality in Android to set the DividerHeight on a ListView. This functionality is not exposed in Alloy.
3 weeks ago this issue was raised: https://developer.appcelerator.com/question/176416/remove-android-listview-separator
In Android, to set the height of the Divider you need to call this function
listView.setDividerHeight(1);
(as explained here: http://stackoverflow.com/questions/11858180/change-the-divider-height-of-listview-dynamically)
It seems trivial to expose this feature to Titanium Developers.
+1!!
Has this issue been prioritised yet for a next release?
This would be welcome, specially as a way to disable the line between rows on Android ListViews... although you can make it transparent, it seems there is always a 1px separator between them, crippling some complex fluid tableview designs...
Test code:
1. Run code, click on the row to toggle divider height. master PR: https://github.com/appcelerator/titanium_mobile/pull/6793/filesvar win = Ti.UI.createWindow(); var listView = Ti.UI.createListView({ separatorColor:'blue', dividerHeight: "3dp" }); var sections = []; var fruitSection = Ti.UI.createListSection(); var fruitDataSet = [ {properties: { title: 'Apple'}}, {properties: { title: 'Banana'}}, {properties: { title: 'Apple'}}, {properties: { title: 'Banana'}}, ]; fruitSection.setItems(fruitDataSet); sections.push(fruitSection); listView.sections = sections; listView.addEventListener('itemclick', function(e){ if (listView.dividerHeight == "3dp") { listView.dividerHeight = 3; } else { listView.dividerHeight = "3dp"; } });Test code I carried out:
var win = Ti.UI.createWindow({backgroundColor:'#000'}); var listView = Ti.UI.createListView({ separatorColor:'blue', dividerHeight: "3dp" }); var sections = []; var fruitSection = Ti.UI.createListSection(); var fruitDataSet = [ {properties: { title: 'Apple'}}, {properties: { title: 'Banana'}}, {properties: { title: 'Apple'}}, {properties: { title: 'Banana'}}, ]; fruitSection.setItems(fruitDataSet); sections.push(fruitSection); listView.sections = sections; listView.addEventListener('itemclick', function(e){ if (listView.dividerHeight == "3dp") { listView.dividerHeight = 20; } else { listView.dividerHeight = "3dp"; } }); win.add(listView); win.open();[~hpham], could you update this ticket with story points? Thank you!
Closing ticket as fixed, if there are any problems, please file a new ticket.