Button onClick and ListView onItemClick
Asked Answered
K

3

6

I got a ListView and I populate it with the view containing buttons. I set onClick listeners to the buttons from the adapted, but when I click the concrete item of the ListView - nothing happens. So, we can say only buttons onClick Listener is called, when I need listViewItem to be clicked. What to do?

Kathikathiawar answered 3/9, 2012 at 12:38 Comment(1)
Post Code what have you implement?Londrina
P
20

Set to your button in xml file: android:focusable="false"

This is because your Button takes focus. So now you can use both onClick for your buttons, and onItemClick for each row in ListView, by telling it that Button should not be focusable.

Particulate answered 3/9, 2012 at 12:40 Comment(1)
yep try this one, i think this one is what u needCutinize
J
0

you need to set on item click like this listView.setOnItemClickListener();

Jarrettjarrid answered 3/9, 2012 at 12:41 Comment(0)
B
0

It is better to do the onlcick on listview item only.You can set some flag and toggle between the functionalities.

Biogen answered 24/7, 2014 at 11:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.