Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-17958] Android: ListView items not correctly updating backgroundColor / backgroundImage on cell reuse

GitHub Issuen/a
TypeBug
PriorityNone
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 3.3.0, Release 3.4.0
Fix Version/sn/a
ComponentsAndroid
LabelsTCSupport
ReporterPhilippe Wueger
AssigneeUnknown
Created2014-09-12T11:52:01.000+0000
Updated2018-02-28T20:03:23.000+0000

Description

Problem Description

ListView items appear with incorrect backgroundColor (or backgroundImage) after scrolling, when the ListView contains _both_ items with _and_ without a backgroundSelectedColor (or backgroundSelectedImage).

Steps to Reproduce

Run the following app

Scroll down to the end of the list

Scroll back up again to the top of the list

Some list items will have no blue background color anymore

(The same thing happens with backgroundImage and backgroundSelectedImage instead of backgroundColor and backgroundSelectedColor).
var items = [
	{ properties: { backgroundColor: 'blue', backgroundSelectedColor: 'red' } },
	{ properties: { backgroundColor: 'blue', backgroundSelectedColor: 'red' } },
	{ properties: { backgroundColor: 'blue', backgroundSelectedColor: 'red' } },
	{ properties: { backgroundColor: 'blue', backgroundSelectedColor: 'red' } },
	{ properties: { backgroundColor: 'blue', backgroundSelectedColor: 'red' } },
	{ properties: { backgroundColor: 'blue' } },
	{ properties: { backgroundColor: 'blue' } },
	{ properties: { backgroundColor: 'blue' } },
	{ properties: { backgroundColor: 'blue' } },
	{ properties: { backgroundColor: 'blue' } }
];

var section = Ti.UI.createListSection({
	items: items
});

var list = Ti.UI.createListView({
	templates: {
		'item': {
			properties: {
				height: '100dp'	
			}
		}
	},
	defaultItemTemplate: 'item',
	sections: [section]
});

var win = Ti.UI.createWindow({});
win.add(list);
win.open();

Actual Results

After scrolling some list items have the wrong background color.

Comments

No comments

JSON Source