Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-17621] Android: Android ListView setDividerHeight is not exposed in Titanium

GitHub Issuen/a
TypeImprovement
PriorityNone
StatusClosed
ResolutionFixed
Resolution Date2015-04-28T04:21:06.000+0000
Affected Version/sRelease 3.3.0
Fix Version/sn/a
ComponentsAndroid
LabelsTCSupport, android, defect
ReporterRene Pot
AssigneeHieu Pham
Created2014-08-14T12:35:43.000+0000
Updated2017-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.

Comments

  1. josh rose 2014-08-15

    +1!!
  2. Rene Pot 2014-08-27

    Has this issue been prioritised yet for a next release?
  3. Ygor Lemos 2014-12-13

    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...
  4. Hieu Pham 2015-04-21

    Test code:
       var 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";
              
          }
       });
       
    1. Run code, click on the row to toggle divider height. master PR: https://github.com/appcelerator/titanium_mobile/pull/6793/files
  5. Ashraf Abu 2015-04-28

    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();
       
       
  6. Ashraf Abu 2015-04-28

    [~hpham], could you update this ticket with story points? Thank you!
  7. Lee Morris 2017-03-31

    Closing ticket as fixed, if there are any problems, please file a new ticket.

JSON Source