rbcc
rbcc

Reputation: 2482

View receives touch events when covered by other view

My Android app has a layout that looks like this:

---------------------
|                   |
|      button       |  <- View panel A
|                   |
---------------------
|                   |
|                   |  <- view panel B (a SurfaceView)
|                   |
|-------------------|

I use a relative layout so that panel B fills the whole screen and panel A is at the top of the screen covering the top of panel B. A is slightly transparent so you can see B under it. Pressing the button on panel A works as expected.

My problem: if I press anywhere on panel A outside of the button, panel B receives a touch event. How can I stop this behaviour?

Upvotes: 1

Views: 123

Answers (1)

ingsaurabh
ingsaurabh

Reputation: 15269

Create a clickListener and attach it to Panel A and dont do anything in that clickListener

Upvotes: 2

Related Questions