Android WindowManager is a system service that is responsible for managing a z-ordered list of windows, which windows are visible and how they are laid out on the screen. Among other things, it automatically performs window transitions and animations when you open or close an application or when you rotate the screen.
Each action has a window that is used to display its contents on the screen. When you call setContentView in action, it attaches this view to the default activity window. The window fills the screen by default, so your activity window hides any other actions - WindowManager will display any window on top. Therefore, as a rule, you do not need to worry about Windows - you just create activity, and Android will do everything for you.
But you need to interact with WindowManager if you want to do something unusual, like creating floating windows that don't fill the screen. If you want to create a floating window that is visible in front of other applications, you cannot use the action because your activity will stop when another application appears in the foreground and its window is hidden or destroyed. Instead, you need to display a window from the background service. For example:
WindowManager.LayoutParams p = new WindowManager.LayoutParams(
To do this, you will need to add the following permissions to your AndroidManifest.xml
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
simonp Mar 16 '14 at 20:40 2014-03-16 20:40
source share