TYPE_SYSTEM_OVERLAY in ICS

Edwin Schriek picture Edwin Schriek · Mar 11, 2012 · Viewed 12.5k times · Source

In Honeycomb I was able to create a system overlay with TYPE_SYSTEM_OVERLAY and receive touches with FLAG_WATCH_OUTSIDE_TOUCH.

Now ICS has changed something. I can still create the system overlay, but i can't get touches.

Now, i am able to create the same with TYPE_SYSTEM_ALERT and get touches, but it just catches the touchevents, and not passing them on like in Honeycomb.

Any idea's?

Kind regards

Answer

jawsware picture jawsware · Jan 4, 2013

To create an overlay view, when setting up the LayoutParams DON'T set the type to TYPE_SYSTEM_OVERLAY.

Instead set it to TYPE_PHONE.

Use the following flags:

FLAG_NOT_TOUCH_MODAL

FLAG_WATCH_OUTSIDE_TOUCH

FLAG_NOT_TOUCH_MODAL << I found this one to be quite important. Without it, focus is given to the overlay and soft-key (home, menu, etc.) presses are not passed to the activity below.