0

我试图动画一列表视图项目儿童的backgroundColor财产的backgroundColor。Appcelerator的:动画列表视图项目

这是代码

var itemToUpdate = myListView.getSections(); 
itemToUpdate = itemToUpdate[0].getItemAt(myPos); 
//itemToUpdate.child_to_update.backgroundColor = myColor; //this works , but without animation 
itemToUpdate.child_to_update.animate({ 
    backgroundColor : myColor, 
    duration : 450 
}); 
myListView.sections[0].updateItemAt(myPos , itemToUpdate); 
+0

请尝试将问题表达为一个问题,并确保您的代码完整。 'catToUpdate'没有被定义,例如 –

+0

对不起,catToUpdate - > itemToUpdate – WhiteLine

回答

1

Ti.UI.ListSection.getItemAt()让你一个ListDataItem的方法。此对象不保存对实际视图的引用,而是保留用于使用您定义的ListView ItemTemplates生成视图的数据。这对性能很好,但它意味着你不能直接操纵视图并使用像animate()这样的方法。

TL; DR你想要什么是不可能使用ListView。考虑使用TableView代替。

+1

我想这是因为这个。我更喜欢表演,所以现在没有动画。谢谢 – WhiteLine