Not hidden elements in ListView cocos2d-x v3.10

Also to scroll through the list and remains the element is displayed without hiding.

auto* listNode = CSLoader::getInstance()->createNode("res/ListNode.csb");
listNode -> setPosition(Vec2(300,700));

auto listView = listNode->getChildByName<ui::ListView*>("ListView_1");
listView->setClippingType(ui::Layout::ClippingType::SCISSOR);

 for(int i = 0; i < 5; i++)
 {

     auto text = StringUtils::format("Text Label %d",i);
     CCLOG("text = %s",text.c_str());

     auto listPartsNode = CSLoader::getInstance()->createNode("res/ListParts.csb");

     auto panelLayout = listPartsNode->getChildByName<ui::Layout*>("Panel_1");

     listPartsNode->removeChild(panelLayout, true);

     panelLayout->getChildByName<ui::Text*>("Text_1")->setString(text);

     auto btn = panelLayout->getChildByName<ui::Button*>("Button_1");
     btn->loadTextureNormal("switch.png");

     listView->addChild(panelLayout);

 }

 this -> addChild(listNode);

How do I fix it ?

Hi @you02,

Just try by setting parameter clipping enable:

listView->setClippingEnabled(true);

Regards,
Gurudath