1.在cocos studio中添加listView。
2.在cocos studio中添加一个layout类型的listItem,设置为不可见。
3.在这个listitem中添加你要在listView中每一项显示的内容。
例如这样:
这个item中有文字,有图片image是layout类型。
4.在代码中调用:
(1)this.mode = this.endLayer.getChildByName("item");获取这个item
(2)然后获得这个item中的每一项进行赋值
var item = this.mode.clone();
item.setVisible(true);
var textLine = item.getChildByName("line");
(3)赋值完成后,调用这句this.endLayerList.pushBackCustomItem(item);加入listView。