here is code to add items, Items are being shown while scrollview sprite component color is white. but when you make color transparent , it does not show items.
start() {
var content = this.node.getChildByName("view").getChildByName("content");
var height = 0;
var scrollheight = 0;
for(let i=1;i<=6;i++){
let newNode = new Node();
resources.load("./assets/item_img"+i.toString()+"/spriteFrame",SpriteFrame,function(err,SpriteFrame){
console.log(err)
newNode.addComponent(Sprite).spriteFrame = SpriteFrame;
});
newNode.layer = Layers.Enum.UI_2D;
height = height - 170;
newNode.setPosition(new Vec3(null,height));
content.addChild(newNode);
scrollheight = scrollheight + 185;
content.getComponent(UITransform).height=scrollheight;
}
}
Screenshot while scrollview color transparent.
Screenshot while scrollview color is white
Thanks