Intercepting touch events on activity and button on Android

Posted by hgpc on Stack Overflow See other posts from Stack Overflow or by hgpc
Published on 2010-04-23T13:09:18Z Indexed on 2010/04/23 13:23 UTC
Read the original article Hit count: 291

Filed under:
|
|
|

I have an Android activity with an ImageButton. I would like to execute some logic when the button is clicked and show a different image for the pressed state, but also receive the touch event on the activity.

By default only the button receives the touch event. If I set the clickable attribute of the button to false then only the activity receives the touch event.

What's the best way to receive the touch event in both the activity and the button?

© Stack Overflow or respective owner

Related posts about android

Related posts about touch-event