I have four ImageButton
s in my app.
Three smaller buttons can be either shown or "hidden" below the bigger button. I hide buttons using rotate and translate animations.
The problem is:
OnClickListener
's onClick
method always gets triggered no matter a smaller button shown or not.
I mean, when smaller buttons are "hidden", touching the place on screen, where one of the smaller button resides when shown, triggers onClick
method.
It looks like Android OS does not take actual placement of the button into account when deciding whether it should trigger onClick
method or not.
How can I overcome the issue?
I want onClick
method to be called ONLY when there is a button below my finger.
EDIT:
All suggested workarounds rely on hiding the button. This doesn't help at all. The onClick
method gets called for INVISIBLE
and GONE
buttons too. I checked this in debugger.