在钛合金中,我如何才能专门针对钛制列表视图中的第一项(我只需要更改第一项的背景颜色)?
带有列表视图的VIEW:
<ListView id="hm_channel_comments" defaultItemTemplate="hm_commentTemplate">
<ListSection name="hm_comments" id="hm_comments_section"/>
香港专业教育学院尝试过的一些方法(总是返回“未定义”):
$.hm_channel_comments.Item[0].setBackgroundColor("blue"); //not working
$.hm_comments_section.itemIndex[0].setBackgroundColor("blue"); //not working
console.log($.hm_comments_section.itemIndex[0] + " $.hm_comments_section.itemIndex[0] "); not working
console.log($.hm_comments_section.item[0] + " $.hm_comments_section.item[0] ");
需要(a)获取特定listsection的listItemObject并(b)更新它。这样的事情(当您只想将backgroundColor更改为listSection的第一项的海军时):
groups.xml包含ID为“ myTeamSectionJoined”的列表部分。
groups.js:
function disableOwnBuddyTransfer(){
var groupFounder = $.myTeamSectionJoined.getItemAt(0);
console.log("groupFounder" + JSON.stringify(groupFounder));
groupFounder.d_four.backgroundColor = "navy";
$.myTeamSectionJoined.updateItemAt(0, groupFounder);
}
真正有用的信息在http://docs.appcelerator.com/platform/latest/#!/guide/Alloy_ListView_Guide
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句