Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-17512

Android: ListView ListItems disappear on scrolling when height set as TI.UI.SIZE

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Low
    • Resolution: Fixed
    • Affects Version/s: Release 3.4.0
    • Fix Version/s: None
    • Component/s: Android
    • Labels:
    • Environment:

      Description

      Steps -
      1. Run the below code sample
      2. Observe that ListView items are appearing in correct order (small medium and big)
      3. Now scroll the list items up and down.
      4. Observe the ListView items.

      Actual result - ListView item “big” is not appearing in the ListView. See the attached screen shot.

      Expected Result - ListView items should not disappear on scrolling the list items

      Additional Info - In the below code, if I set the height (ex - height : ’20dp’) instead of height : TI.UI.SIZE then scrolling is working fine
      Note - Working fine on iOS device.

      var aWindow = Ti.UI.createWindow({
      	title : "ListView Template",
      	backgroundColor : 'white'
      });
      var itemTemplate = {
      	childTemplates : [{
      		type : 'Ti.UI.View',
      		bindId : 'addressView',
      		properties : {
      			layout : 'vertical',
      			left : 10,
      			width : Ti.UI.SIZE,
      			touchEnabled : false,
      			height : Ti.UI.SIZE,
      			top : 10,
      			bottom : 10
      		},
      		childTemplates : [{
      			type : 'Ti.UI.Label',
      			bindId : 'lblText1',
      			properties : {
      				color : 'black',
      				width : Ti.UI.SIZE,
      				height : Ti.UI.SIZE
      			}
      		}, {
      			type : 'Ti.UI.Label',
      			bindId : 'lblText2',
      			properties : {
      				color : 'green',
      				borderColor : 'green',
      				top : 3,
      				bottom : 3,
      				left : 3,
      				right : 3,
      				borderWidth : 1,
      				width : Ti.UI.SIZE,
      				height : Ti.UI.SIZE
      			}
      		}, {
      			type : 'Ti.UI.Label',
      			bindId : 'lblText3',
      			properties : {
      				color : 'black',
      				width : Ti.UI.SIZE,
      				height : Ti.UI.SIZE
      			}
      		}]
      	}]
      };
       
      var listItems = [];
      for (var i = 0; i < 20; i++) {
      	listItems.push({
      		lblText1 : {
      			text : i + ' small'
      		},
      		lblText2 : {
      			text : i + ' medium'
      		},
      		lblText3 : {
      			text : i + ' big'
      		},
      		properties : {
      			id : i,
      			backgroundColor : 'white',
      			height : Ti.UI.SIZE,
      			selectedBackgroundColor : 'gray'
      		}
      	});
       
      }
      var listSection = Ti.UI.createListSection({
      	items : listItems
      });
      var listView = Ti.UI.createListView({
      	templates : {
      		'itemTemp' : itemTemplate
      	},
      	separatorColor:'red',
      	defaultItemTemplate : 'itemTemp',
      	sections : [listSection]
      });
       
      aWindow.add(listView);
      aWindow.open();
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                emerriman Eric Merriman
                Reporter:
                djha Dhirendra Jha
              • Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-19085
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Source Code