WindowManager

interface WindowManager : ViewManager
android.view.WindowManager

The interface that apps use to talk to the window manager.

Each window manager instance is bound to a particular Display. To obtain a WindowManager for a different display, use Context#createDisplayContext to obtain a Context for that display, then use Context.getSystemService(Context.WINDOW_SERVICE) to get the WindowManager.

The simplest way to show a window on another display is to create a Presentation. The presentation will automatically obtain a WindowManager and Context for that display.

Summary

Nested classes
open

Exception that is thrown when trying to add view whose LayoutParams LayoutParams#token is invalid.

open

Exception that is thrown when calling #addView to a secondary display that cannot be found.

open

Public methods
abstract Display!

Returns the Display upon which this WindowManager instance will create new windows.

abstract Unit

Special variation of #removeView that immediately invokes the given view hierarchy's View.onDetachedFromWindow() methods before returning.

Inherited functions

Public methods

getDefaultDisplay

abstract fun getDefaultDisplay(): Display!

Returns the Display upon which this WindowManager instance will create new windows.

Despite the name of this method, the display that is returned is not necessarily the primary display of the system (see Display#DEFAULT_DISPLAY). The returned display could instead be a secondary display that this window manager instance is managing. Think of it as the display that this WindowManager instance uses by default.

To create windows on a different display, you need to obtain a WindowManager for that Display. (See the WindowManager class documentation for more information.)

Return
Display!: The display that this window manager is managing.

removeViewImmediate

abstract fun removeViewImmediate(view: View!): Unit

Special variation of #removeView that immediately invokes the given view hierarchy's View.onDetachedFromWindow() methods before returning. This is not for normal applications; using it correctly requires great care.

Parameters
view View!: The view to be removed.