Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is a button clickable when theres another layout overlaying it?

I got a Layout which is relatively positioned. In it I got (by now) two things:

  • A Clickable Button which is bound to an onClick-Event
  • A LinearLayout which is overlaying the full screen

Although the LinearLayout is overlaying the button, the button is still clickable. Even if there's another button in the overlay.

How can I avoid this?

like image 790
androidavid Avatar asked Jan 21 '26 14:01

androidavid


1 Answers

The overlaying views (and layouts) have to implement an onClick listener to catch the event, otherwise the event is dispatched on the underlaying views.

like image 95
e.perrot Avatar answered Jan 23 '26 04:01

e.perrot