I realize that listview item click event is not working the specific case.


In my case, Cocos2dx v.3.10

What I found is that setTouchEnabled(true) for both (one for list , other for list item)

To clearly check below code 


[Header file]

void initListView();

void addItemIntoList(ListView* pListView);


// event listen callback function for listview click

void cbListItemClickEvent(Ref *pSender, ListView::EventType type);


[Source file]

void SampleLayer::initListView()

{

auto list= ListView::create();


  // add event listener

list->addEventListenerListView(this, listvieweventselector(ExamLayer::cbDontKnowWordEvent));


  // important to set this flag

list->setTouchEnabled(true);


  ...

  ...


  addItemIntoList(list);

}


void SampleLayer::addItemIntoList(ListView* pListView)

{

auto item= Layout::create();

item->setTag(iId);

item->setCascadeOpacityEnabled(true);


// important to set this flag

item->setTouchEnabled(true);


pListView->pushBackCustomItem(item);

}


void SampleLayer::cbListItemClickEvent(Ref *pSender, ListView::EventType type)

{

switch (type)

{

case cocos2d::ui::ListView::EventType::ON_SELECTED_ITEM_END:

{

ListView* listView = static_cast<ListView*>(pSender);

int at = listView->getCurSelectedIndex();

break;

}

default:

break;

}

}


By doing this I solved the issue on listview click event is not called.