Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19140] Ti.UI.ListView.dividerHeight does not accept value of 0

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2015-07-03T02:27:26.000+0000
Affected Version/sRelease 4.1.0
Fix Version/sRelease 4.1.0
ComponentsAndroid
Labelslistview, qe-4.1.0
ReporterChris Bowley
AssigneeAshraf Abu
Created2015-07-02T08:37:39.000+0000
Updated2015-07-14T17:06:53.000+0000

Description

Ti.UI.ListView.dividerHeight does not accept value of 0 which means you cannot remove the divider in Android ListView. https://github.com/appcelerator/titanium_mobile/blob/f8d4137ddbff4d1eacc7224f0cba1b374f7dec54/android/modules/ui/src/java/ti/modules/titanium/ui/widget/listview/TiListView.java#L500

Comments

  1. Collin Price 2015-07-02

    Submitted PR https://github.com/appcelerator/titanium_mobile/pull/6952
  2. Ashraf Abu 2015-07-03

    Test code:-
       var win = Ti.UI.createWindow({backgroundColor:'#000'});
         
       var listView = Ti.UI.createListView({ 
       	separatorColor:'blue',
       	separatorHeight: "5dp"
        
        
       });
        
        
        
       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.separatorHeight == "5dp") {
         
              listView.separatorHeight = 0;
         
          } else {
         
              listView.separatorHeight = "5dp";
          }
         
       });
        
       win.add(listView);
       win.open();
       
  3. Ashraf Abu 2015-07-03

    4_1_X Backport PR: https://github.com/appcelerator/titanium_mobile/pull/6953
  4. Ashraf Abu 2015-07-03

    Thanks for the PR [~CollinPrice]. PR merged and back ported.
  5. Fokke Zandbergen 2015-07-03

    Some say we should also set the divider itself to @null: http://stackoverflow.com/questions/1914477/how-to-remove-line-inbetween-two-listviews-in-android
  6. Ashraf Abu 2015-07-03

    Hmmm. I think it is acceptable right now to set it as 0 and not null. Is there any reason it has to be set to null as well? I'm trying to find out if it impacts anything if it is set to 0 and not null. So far, it seems to be working as expected.
  7. Lokesh Choudhary 2015-07-14

    Verified the fix. Closing. Environment: Appc Studio : 4.1.0.201507071122 Ti SDK : 4.2.0.v20150714071826, 4.1.0.GA Ti CLI : 4.0.1 Alloy : 1.6.2 MAC Yosemite : 10.10.4 Appc NPM : 4.1.0 Appc CLI : 4.1.0 Node: v0.10.37 Nexus 5 - Android 5.1.1 Genymotion emulator - android 4.4.4

JSON Source