I am using the last version of Titanium SDK. I want to change the background of item in listview but it seems impossible.
I tried to use:
var item = $.section.getItemAt(index);
item.properties.backgroundColor = "#696969";
$.section.updateItemAt(index, item);
But I get the error said that the backgroundColor undefined... I find a solution is that using a View with size of the list item and then set background color for this View to archive the same result. However, I can not find a way to access the view inside the list item.
Someone have done this please give me your opinion. Thanks. :)
I find out that I need to specific the properties element on the data item.
var item = {
bind1: {
text : value1
},
bind2: {
text : value2
},
properties:{
backgroundColor:"#aaaaaa"
}
};
Now the code:
var item = $.section.getItemAt(index);
item.properties.backgroundColor = "#696969";
$.section.updateItemAt(index, item);
works as expected.
:)