I've looked everywhere for a solution to this, but I can't figure out how to implement it. My OnItemClickListener
was disabled somehow on my ListView
rows, because I have an ImageButton
in the row layout, which takes over the focus. There have been numerous questions I've found, but none of them have gotten me anywhere.
I've checked this question, but I couldn't really make heads or tails of it. I just need a way to get the rows clickable so that I can detect when a row is pressed. Long press and focus work fine.
I have sub-classed
ImageButton
andsetFocusable="false"
in layout definition didn't work for me. It solved callingsetFocusable(false)
in constructor of subclass.This will definitely work. Add this to the layout definition.
Found the solution here
best way to do is this:
set these properties for that
Imagebutton
and try. IUsing a
ScrollView
can prevent theonItemClickListener
from receiving the input.Hope this helps anyone.
Y this toast isn not working
set your
ImageButton
's attribute:Because
AbsListView.onTouchEvent
checkchild.hasFocusable()
.