I’m making a listview with custom adapter / custom item layout (2x TextViews and 4x ImageButtons) and i want to be able to long press the list item to do something and still be able to press the ImageButtons on the layout.
The problem is that if i just have TextViews it works and catches the Long press event, as soon as i add an ImageButton the Long press event stops working. Any idea why this is happening?
When you add clickable views (like buttons) in your item layout they catch the click event and it doesn’t bubble to the underlying
ListView, to fix this you can add the long click listener to the items’ root layout.So instead of doing this in your activity:
you do this in your adapter: