OnClick button and ListView onItemClick

I have a ListView and I populate it with a view containing buttons. I set the onClick listeners with buttons from the adapted one, but when I click on a specific ListView element, nothing happens. So we can say that only the onClick Listener buttons are called when I need to click listViewItem. What to do?

+5
source share
3 answers

Install your button in the xml file: android:focusable="false"

This is because your button focuses. So, now you can use both onClick for your buttons and onItemClick for each row in the ListView, telling it that Button should not be configured.

+18
source

, : listView.setOnItemClickListener();

0

onlcick listview. .

0
source

All Articles