I made an activity extended from ExpandableListActivity with ExpandableListView. I added a button into an item layout. With SimpleExpandableListAdapter derived class I provided a click listener to my buttons (some of them were put into gone visibility state, if they weren’t relevant).
If the button is not visible (gone), I can handle child view’s events (click, long click). However, if the button is visible no events are caught by listeners, neither child’s state changes are invisible (focus, selection…).
As a child view I use RelativeLayout with several TextViews and a button.
How can I catch that events?
Thanks for any advice.
You have set focusable to false for the button:
It works like this, when ever you have a element of clickable type, it takes the focus by default and it will not allow your child view click event to respond. The solution is to makes its focus to false and no other way. But still you can have the
ClickListenerworking for your button too. Won’t be a problem there.