Android app that runs on top of ALL other apps?

前端 未结 3 2101
既然无缘
既然无缘 2021-01-31 21:59

Before today I would have said this is just not possible, to have an app that runs overlayed on top of everything else: home screens, apps, dialer, etc.

If you try the f

3条回答
  •  半阙折子戏
    2021-01-31 22:25

    This can be done by a combination of things. The initial button is done by creating a window of type TYPE_SYSTEM_OVERLAY . These windows cannot gain focus, however you can use FLAG_WATCH_OUTSIDE_TOUCH to get touch events and match up the coordinates to realized you've been touched.

    Similarly there is http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#TYPE_SYSTEM_ALERT (And TYPE_SYSTEM_DIALOG).

    Finally, an activity can be created with http://developer.android.com/reference/android/R.style.html#Theme_Translucent (or variants).

提交回复
热议问题