How to create an overlay that blocks touch events to UI below it?

NeoWang picture NeoWang · Jan 3, 2015 · Viewed 13.5k times · Source

I used a layer of framelayout with a semi-translucent background to create an overlay. But this overlay doesn't block touch events to interact with the views below it. How should create an overlay that blocks all touch events?

Answer

PPD picture PPD · Jan 3, 2015

If overlay doesn't get touch events, then the events are passed to underlying view, so to block touch events in views below it, make your overlay touchable. android:clickable="true"