Cristian C. Cristian C. - 5 months ago 49
Android Question

Entire screen overlay

just a simple question (hopefully):

Is there any easy way to make a simple translucent screen overlay on android? Just a solid color would work perfectly for starters. I would wager that this wouldnt be started as an activity but run as a service since the overlay should display over everything always until disabled, whether or not the application that hosts this overlay is running/paused/stoped.

It's easy to make an overlay for a specific activity/fragment, but I'd want this overlay to appear over the entire screen regardless of what's on screen (except maybe error dialogs, those seem to take presidence over anything).

Edit: To add more information, apps like "twilight" and "screen filter" seem to be able to do this sort of thing, whereas they are able to display a color at a custom transparency over the entire screen whether or not the app is running.


Yeah, it's possible to implement entire screen overlay using SYSTEM_ALERT_WINDOW permission and WindowManager, that's how Facebook chat heads works. Basically, you need to add your View to WindowManager instance, search WindowManager for more information.