How to create an UI or a widget that sits on top of all applications in Android?

前端 未结 2 1174
迷失自我
迷失自我 2020-12-08 05:57

Can I create an UI or a widget in Android that will sit on top of all applications? There are applications that have widgets like this. One example has a camera icon on top

2条回答
  •  臣服心动
    2020-12-08 06:23

    The following are more options for how the view is displayed.

    This will make it an overlay on top of everything (including lock screen), but not clickable. WindowManager.LayoutParams. TYPE_SYSTEM_OVERLAY

    This will make it clickable, but it won't be over the lock screen WindowManager.LayoutParams.TYPE_SYSTEM_ALERT

    This will make it above everything (including lock screen) AND clickable. WindowManager.LayoutParams.TYPE_SYSTEM_ERROR

    One thing to note about using "TYPE_SYSTEM_ERROR". If you wire-in a click event, anything it invokes will happen behind the lock screen.

提交回复
热议问题