Android Guides | Samples

Android.Views.WindowManagerFlags Enumeration

Enumerates values returned by several types and taken as a parameter of several types.

Syntax

[System.Flags]
public enum WindowManagerFlags

Remarks

Members

Member NameDescription
AllowLockWhileScreenOnWindow flag: as long as this window is visible to the user, allow the lock screen to activate while the screen is on. This can be used independently, or in combination with WindowManagerFlags.KeepScreenOn and/or WindowManagerFlags.ShowWhenLocked
AltFocusableImWindow flag: invert the state of WindowManagerFlags.NotFocusable with respect to how this window interacts with the current method. That is, if FLAG_NOT_FOCUSABLE is set and this flag is set, then the window will behave as if it needs to interact with the input method and thus be placed behind/away from it; if FLAG_NOT_FOCUSABLE is not set and this flag is set, then the window will behave as if it doesn't need to interact with the input method and can be placed to use more space and cover the input method.
BlurBehindWindow flag: blur everything behind this window.
DimBehindWindow flag: everything behind this window will be dimmed. Use WindowManagerLayoutParams.DimAmount to control the amount of dim.
DismissKeyguardWindow flag: when set the window will cause the keyguard to be dismissed, only if it is not a secure lock keyguard. Because such a keyguard is not needed for security, it will never re-appear if the user navigates to another window (in contrast to WindowManagerFlags.ShowWhenLocked, which will only temporarily hide both secure and non-secure keyguards but ensure they reappear when the user moves to another UI that doesn't hide them). If the keyguard is currently active and is secure (requires an unlock pattern) than the user will still need to confirm it before seeing this window, unless WindowManagerFlags.ShowWhenLocked has also been set.
DitherWindow flag: turn on dithering when compositing this window to the screen.
DrawsSystemBarBackgrounds
ForceNotFullscreenWindow flag: override WindowManagerFlags.Fullscreen and force the screen decorations (such as the status bar) to be shown.
Fullscreen

Window flag: hide all screen decorations (such as the status bar) while this window is displayed. This allows the window to use the entire display space for itself -- the status bar will be hidden when an app window with this flag set is on the top layer. A fullscreen window will ignore a value of SoftInput.AdjustResize for the window's WindowManagerLayoutParams.SoftInputMode field; the window will stay fullscreen and will not resize.

This flag can be controlled in your theme through the Resource+Attribute.WindowFullScreen attribute; this attribute is automatically set for you in the standard fullscreen themes such as Style.ThemeNoTitleBarFullScreen, Style.ThemeBlackNoTitleBarFullScreen, Style.ThemeLightNoTitleBarFullScreen, Style.ThemeHoloNoActionBarFullscreen, Style.ThemeHoloLightNoActionBarFullscreen, Resource+Style.ThemeDeviceDefault, and Resource+Style.ThemeDeviceDefault.

HardwareAccelerated

Indicates whether this window should be hardware accelerated. Requesting hardware acceleration does not guarantee it will happen.

This flag can be controlled programmatically only to enable hardware acceleration. To enable hardware acceleration for a given window programmatically, do the following:

It is important to remember that this flag must be set before setting the content view of your activity or dialog.

This flag cannot be used to disable hardware acceleration after it was enabled in your manifest using Attribute.HardwareAccelerated. If you need to selectively and programmatically disable hardware acceleration (for automated testing for instance), make sure it is turned off in your manifest and enable it on your activity or dialog when you need it instead, using the method described above.

This flag is automatically set by the system if the Attribute.HardwareAccelerated XML attribute is set to true on an activity or on the application.

IgnoreCheekPressesWindow flag: intended for windows that will often be used when the user is holding the screen against their face, it will aggressively filter the event stream to prevent unintended presses in this situation that may not be desired for a particular window, when such an event stream is detected, the application will receive a CANCEL motion event to indicate this so applications can handle this accordingly by taking no action on the event until the finger is released.
KeepScreenOnWindow flag: as long as this window is visible to the user, keep the device's screen turned on and bright.
LayoutInOverscan

Window flag: allow window contents to extend in to the screen's overscan area, if there is one. The window should still correctly position its contents to take the overscan area into account.

This flag can be controlled in your theme through the Attribute.WindowOverscan attribute; this attribute is automatically set for you in the standard overscan themes such as Style.ThemeHoloNoActionBarOverscan, Style.ThemeHoloLightNoActionBarOverscan, Resource+Style.ThemeDeviceDefault, and Resource+Style.ThemeDeviceDefault.

When this flag is enabled for a window, its normal content may be obscured to some degree by the overscan region of the display. To ensure key parts of that content are visible to the user, you can use View.SetFitsSystemWindows(Boolean) to set the point in the view hierarchy where the appropriate offsets should be applied. (This can be done either by directly calling this function, using the Attribute.FitsSystemWindows attribute in your view hierarchy, or implementing you own View.FitSystemWindows(Rect) method).

This mechanism for positioning content elements is identical to its equivalent use with layout and View.SystemUiVisibility; here is an example layout that will correctly position its UI elements with this overscan flag is set:

LayoutInScreenWindow flag: place the window within the entire screen, ignoring decorations around the border (such as the status bar). The window must correctly position its contents to take the screen decoration into account. This flag is normally set for you by Window as described in Window.SetFlags(WindowManagerFlags,WindowManagerFlags).
LayoutInsetDecorWindow flag: a special option only for use in combination with WindowManagerFlags.LayoutInScreen. When requesting layout in the screen your window may appear on top of or behind screen decorations such as the status bar. By also including this flag, the window manager will report the inset rectangle needed to ensure your content is not covered by screen decorations. This flag is normally set for you by Window as described in Window.SetFlags(WindowManagerFlags,WindowManagerFlags).
LayoutNoLimitsWindow flag: allow window to extend outside of the screen.
LocalFocusMode
NotFocusable

WindowManagerFlags.NotTouchModal

Setting this flag also implies that the window will not need to interact with a soft input method, so it will be Z-ordered and positioned independently of any active input method (typically this means it gets Z-ordered on top of the input method, so it can use the full screen for its content and cover the input method if needed. You can use WindowManagerFlags.AltFocusableIm to modify this behavior.

NotTouchableWindow flag: this window can never receive touch events.
NotTouchModalWindow flag: even when this window is focusable (its WindowManagerFlags.NotFocusable is not set), allow any pointer events outside of the window to be sent to the windows behind it. Otherwise it will consume all pointer events itself, regardless of whether they are inside of the window.
ScaledWindow flag: a special mode where the layout parameters are used to perform scaling of the surface when it is composited to the screen.
Secure

See Display.FlagSecure for more details about secure surfaces and secure displays.

ShowWallpaper

Window flag: ask that the system wallpaper be shown behind your window. The window surface must be translucent to be able to actually see the wallpaper behind it; this flag just ensures that the wallpaper surface will be there if this window actually has translucent regions.

This flag can be controlled in your theme through the Attribute.WindowShowWallpaper attribute; this attribute is automatically set for you in the standard wallpaper themes such as Style.ThemeWallpaper, Style.ThemeWallpaperNoTitleBar, Style.ThemeWallpaperNoTitleBarFullscreen, Style.ThemeHoloWallpaper, Style.ThemeHoloWallpaperNoTitleBar, Resource+Style.ThemeDeviceDefault, and Resource+Style.ThemeDeviceDefault.

ShowWhenLockedWindow flag: special flag to let windows be shown when the screen is locked. This will let application windows take precedence over key guard or any other lock screens. Can be used with WindowManagerFlags.KeepScreenOn to turn screen on and display windows directly before showing the key guard window. Can be used with WindowManagerFlags.DismissKeyguard to automatically fully dismisss non-secure keyguards. This flag only applies to the top-most full-screen window.
SplitTouchWindow flag: when set the window will accept for touch events outside of its bounds to be sent to other windows that also support split touch. When this flag is not set, the first pointer that goes down determines the window to which all subsequent touches go until all pointers go up. When this flag is set, each pointer (not necessarily the first) that goes down determines the window to which all subsequent touches of that pointer will go until that pointer goes up thereby enabling touches with multiple pointers to be split across multiple windows.
TouchableWhenWakingWindow flag: when set, if the device is asleep when the touch screen is pressed, you will receive this first touch event. Usually the first touch event is consumed by the system since the user can not see what they are pressing on.
TranslucentNavigation
TranslucentStatus
TurnScreenOnWindow flag: when set as a window is being added or made visible, once the window has been shown then the system will poke the power manager's user activity (as if the user had woken up the device) to turn the screen on.
WatchOutsideTouchWindow flag: if you have set WindowManagerFlags.NotTouchModal, you can set this flag to receive a single special MotionEvent with the action MotionEventActions.Outside for touches that occur outside of your window. Note that you will not receive the full down/move/up gesture, only the location of the first down as an ACTION_OUTSIDE.

Requirements

Namespace: Android.Views
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0

The members of Android.Views.WindowManagerFlags are listed below.

See Also: Enum

Public Fields

AllowLockWhileScreenOnWindowManagerFlags. Window flag: as long as this window is visible to the user, allow the lock screen to activate while the screen is on. This can be used independently, or in combination with WindowManagerFlags.KeepScreenOn and/or WindowManagerFlags.ShowWhenLocked
AltFocusableImWindowManagerFlags. Window flag: invert the state of WindowManagerFlags.NotFocusable with respect to how this window interacts with the current method. That is, if FLAG_NOT_FOCUSABLE is set and this flag is set, then the window will behave as if it needs to interact with the input method and thus be placed behind/away from it; if FLAG_NOT_FOCUSABLE is not set and this flag is set, then the window will behave as if it doesn't need to interact with the input method and can be placed to use more space and cover the input method.
BlurBehindWindowManagerFlags. Window flag: blur everything behind this window.
DimBehindWindowManagerFlags. Window flag: everything behind this window will be dimmed. Use WindowManagerLayoutParams.DimAmount to control the amount of dim.
DismissKeyguardWindowManagerFlags. Window flag: when set the window will cause the keyguard to be dismissed, only if it is not a secure lock keyguard. Because such a keyguard is not needed for security, it will never re-appear if the user navigates to another window (in contrast to WindowManagerFlags.ShowWhenLocked, which will only temporarily hide both secure and non-secure keyguards but ensure they reappear when the user moves to another UI that doesn't hide them). If the keyguard is currently active and is secure (requires an unlock pattern) than the user will still need to confirm it before seeing this window, unless WindowManagerFlags.ShowWhenLocked has also been set.
DitherWindowManagerFlags. Window flag: turn on dithering when compositing this window to the screen.
DrawsSystemBarBackgroundsWindowManagerFlags.
ForceNotFullscreenWindowManagerFlags. Window flag: override WindowManagerFlags.Fullscreen and force the screen decorations (such as the status bar) to be shown.
FullscreenWindowManagerFlags.

Window flag: hide all screen decorations (such as the status bar) while this window is displayed. This allows the window to use the entire display space for itself -- the status bar will be hidden when an app window with this flag set is on the top layer. A fullscreen window will ignore a value of SoftInput.AdjustResize for the window's WindowManagerLayoutParams.SoftInputMode field; the window will stay fullscreen and will not resize.

This flag can be controlled in your theme through the Resource+Attribute.WindowFullScreen attribute; this attribute is automatically set for you in the standard fullscreen themes such as Style.ThemeNoTitleBarFullScreen, Style.ThemeBlackNoTitleBarFullScreen, Style.ThemeLightNoTitleBarFullScreen, Style.ThemeHoloNoActionBarFullscreen, Style.ThemeHoloLightNoActionBarFullscreen, Resource+Style.ThemeDeviceDefault, and Resource+Style.ThemeDeviceDefault.

HardwareAcceleratedWindowManagerFlags.

Indicates whether this window should be hardware accelerated. Requesting hardware acceleration does not guarantee it will happen.

This flag can be controlled programmatically only to enable hardware acceleration. To enable hardware acceleration for a given window programmatically, do the following:

It is important to remember that this flag must be set before setting the content view of your activity or dialog.

This flag cannot be used to disable hardware acceleration after it was enabled in your manifest using Attribute.HardwareAccelerated. If you need to selectively and programmatically disable hardware acceleration (for automated testing for instance), make sure it is turned off in your manifest and enable it on your activity or dialog when you need it instead, using the method described above.

This flag is automatically set by the system if the Attribute.HardwareAccelerated XML attribute is set to true on an activity or on the application.

IgnoreCheekPressesWindowManagerFlags. Window flag: intended for windows that will often be used when the user is holding the screen against their face, it will aggressively filter the event stream to prevent unintended presses in this situation that may not be desired for a particular window, when such an event stream is detected, the application will receive a CANCEL motion event to indicate this so applications can handle this accordingly by taking no action on the event until the finger is released.
KeepScreenOnWindowManagerFlags. Window flag: as long as this window is visible to the user, keep the device's screen turned on and bright.
LayoutInOverscanWindowManagerFlags.

Window flag: allow window contents to extend in to the screen's overscan area, if there is one. The window should still correctly position its contents to take the overscan area into account.

This flag can be controlled in your theme through the Attribute.WindowOverscan attribute; this attribute is automatically set for you in the standard overscan themes such as Style.ThemeHoloNoActionBarOverscan, Style.ThemeHoloLightNoActionBarOverscan, Resource+Style.ThemeDeviceDefault, and Resource+Style.ThemeDeviceDefault.

When this flag is enabled for a window, its normal content may be obscured to some degree by the overscan region of the display. To ensure key parts of that content are visible to the user, you can use View.SetFitsSystemWindows(Boolean) to set the point in the view hierarchy where the appropriate offsets should be applied. (This can be done either by directly calling this function, using the Attribute.FitsSystemWindows attribute in your view hierarchy, or implementing you own View.FitSystemWindows(Rect) method).

This mechanism for positioning content elements is identical to its equivalent use with layout and View.SystemUiVisibility; here is an example layout that will correctly position its UI elements with this overscan flag is set:

LayoutInScreenWindowManagerFlags. Window flag: place the window within the entire screen, ignoring decorations around the border (such as the status bar). The window must correctly position its contents to take the screen decoration into account. This flag is normally set for you by Window as described in Window.SetFlags(WindowManagerFlags,WindowManagerFlags).
LayoutInsetDecorWindowManagerFlags. Window flag: a special option only for use in combination with WindowManagerFlags.LayoutInScreen. When requesting layout in the screen your window may appear on top of or behind screen decorations such as the status bar. By also including this flag, the window manager will report the inset rectangle needed to ensure your content is not covered by screen decorations. This flag is normally set for you by Window as described in Window.SetFlags(WindowManagerFlags,WindowManagerFlags).
LayoutNoLimitsWindowManagerFlags. Window flag: allow window to extend outside of the screen.
LocalFocusModeWindowManagerFlags.
NotFocusableWindowManagerFlags.

WindowManagerFlags.NotTouchModal

Setting this flag also implies that the window will not need to interact with a soft input method, so it will be Z-ordered and positioned independently of any active input method (typically this means it gets Z-ordered on top of the input method, so it can use the full screen for its content and cover the input method if needed. You can use WindowManagerFlags.AltFocusableIm to modify this behavior.

NotTouchableWindowManagerFlags. Window flag: this window can never receive touch events.
NotTouchModalWindowManagerFlags. Window flag: even when this window is focusable (its WindowManagerFlags.NotFocusable is not set), allow any pointer events outside of the window to be sent to the windows behind it. Otherwise it will consume all pointer events itself, regardless of whether they are inside of the window.
ScaledWindowManagerFlags. Window flag: a special mode where the layout parameters are used to perform scaling of the surface when it is composited to the screen.
SecureWindowManagerFlags.

See Display.FlagSecure for more details about secure surfaces and secure displays.

ShowWallpaperWindowManagerFlags.

Window flag: ask that the system wallpaper be shown behind your window. The window surface must be translucent to be able to actually see the wallpaper behind it; this flag just ensures that the wallpaper surface will be there if this window actually has translucent regions.

This flag can be controlled in your theme through the Attribute.WindowShowWallpaper attribute; this attribute is automatically set for you in the standard wallpaper themes such as Style.ThemeWallpaper, Style.ThemeWallpaperNoTitleBar, Style.ThemeWallpaperNoTitleBarFullscreen, Style.ThemeHoloWallpaper, Style.ThemeHoloWallpaperNoTitleBar, Resource+Style.ThemeDeviceDefault, and Resource+Style.ThemeDeviceDefault.

ShowWhenLockedWindowManagerFlags. Window flag: special flag to let windows be shown when the screen is locked. This will let application windows take precedence over key guard or any other lock screens. Can be used with WindowManagerFlags.KeepScreenOn to turn screen on and display windows directly before showing the key guard window. Can be used with WindowManagerFlags.DismissKeyguard to automatically fully dismisss non-secure keyguards. This flag only applies to the top-most full-screen window.
SplitTouchWindowManagerFlags. Window flag: when set the window will accept for touch events outside of its bounds to be sent to other windows that also support split touch. When this flag is not set, the first pointer that goes down determines the window to which all subsequent touches go until all pointers go up. When this flag is set, each pointer (not necessarily the first) that goes down determines the window to which all subsequent touches of that pointer will go until that pointer goes up thereby enabling touches with multiple pointers to be split across multiple windows.
TouchableWhenWakingWindowManagerFlags. Window flag: when set, if the device is asleep when the touch screen is pressed, you will receive this first touch event. Usually the first touch event is consumed by the system since the user can not see what they are pressing on.
TranslucentNavigationWindowManagerFlags.
TranslucentStatusWindowManagerFlags.
TurnScreenOnWindowManagerFlags. Window flag: when set as a window is being added or made visible, once the window has been shown then the system will poke the power manager's user activity (as if the user had woken up the device) to turn the screen on.
WatchOutsideTouchWindowManagerFlags. Window flag: if you have set WindowManagerFlags.NotTouchModal, you can set this flag to receive a single special MotionEvent with the action MotionEventActions.Outside for touches that occur outside of your window. Note that you will not receive the full down/move/up gesture, only the location of the first down as an ACTION_OUTSIDE.