This has been addressed in many posts on StackOverflow. The most recommended solution is to set:
android:descendantFocusability=\"blocksDescendants\"
Try using this inside each button layouts
android:focusable="false"
android:focusableInTouchMode="false"
and remove other thing which you are doing for this. Also from listview. Also remove this
android:descendantFocusability="blocksDescendants"
and this too
parent.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
((ViewGroup) v).setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
Have you tried adding android:clickable="false" for the buttons? I just ran into a similar issue and that fixed it for me, whereas using android:focusable="false" did not.
Good luck!
Just put
android:focusable="false"
in the row/item.xml of the listView .
It solve all your problem. if you put an event listener on the listView
.. It will not let you click on whole ListView Row. I mean
listView.setOnClickListener(this);
will not be called . because the focus moves to the row/item of the listView
. By adding android:focusable="false"
to the Button or ImageView on which you put an Event . It will lose their focus and the focus is gain by listView. Now you can have listView clickable as well as its descendents rows/item..
In short just put android:focusable="false
in TextView/Button or ImageView
which have event Listeners in the Item/row.xml.