Window Class

Definition

Abstract base class for a top-level window look and behavior policy.

[Android.Runtime.Register("android/view/Window", DoNotGenerateAcw=true)]
public abstract class Window : Java.Lang.Object
[<Android.Runtime.Register("android/view/Window", DoNotGenerateAcw=true)>]
type Window = class
    inherit Object
Inheritance
Attributes

Remarks

Abstract base class for a top-level window look and behavior policy. An instance of this class should be used as the top-level view added to the window manager. It provides standard UI policies such as a background, title area, default key processing, etc.

The framework will instantiate an implementation of this class on behalf of the application.

Java documentation for android.view.Window.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

Name Description
Window(Context)

Initializes a new instance of Window.

Window(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

Fields

Name Description
DecorCaptionShadeAuto
Obsolete.

Flag for letting the theme drive the color of the window caption controls.

DecorCaptionShadeDark
Obsolete.

Flag for setting dark-color controls on the window caption.

DecorCaptionShadeLight
Obsolete.

Flag for setting light-color controls on the window caption.

IdAndroidContent

The ID that the main layout in the XML layout file should have.

NavigationBarBackgroundTransitionName

The transitionName for the navigation bar background View when a custom background is used.

ProgressEnd

Ending value for the (primary) progress.

ProgressIndeterminateOff

Flag for setting the progress bar's indeterminate mode off.

ProgressIndeterminateOn

Flag for setting the progress bar's indeterminate mode on.

ProgressSecondaryEnd

Highest possible value for the secondary progress.

ProgressSecondaryStart

Lowest possible value for the secondary progress.

ProgressStart

Starting value for the (primary) progress.

ProgressVisibilityOff

Flag for setting the progress bar's visibility to GONE.

ProgressVisibilityOn

Flag for setting the progress bar's visibility to VISIBLE.

StatusBarBackgroundTransitionName

The transitionName for the status bar background View when a custom background is used.

Properties

Name Description
AllowEnterTransitionOverlap

Returns how the transition set in #setEnterTransition(android.transition.Transition) overlaps with the exit transition of the calling Activity.; Controls how the transition set in #setEnterTransition(android.transition.Transition) overlaps with the exit transition of the calling Activity.

AllowReturnTransitionOverlap

Returns how the transition set in #setExitTransition(android.transition.Transition) overlaps with the exit transition of the called Activity when reentering after if finishes.; Controls how the transition set in #setExitTransition(android.transition.Transition) overlaps with the exit transition of the called Activity when reentering after if finishes.

Attributes

Retrieve the current window attributes associated with this panel.; Specify custom window attributes.

Callback

Return the current Callback interface for this window.; Set the Callback interface for this window, used to intercept key events and other dynamic operations in the window.

Class

Returns the runtime class of this Object.

(Inherited from Object)
ColorMode

Returns the requested color mode of the window, one of ActivityInfo#COLOR_MODE_DEFAULT, ActivityInfo#COLOR_MODE_WIDE_COLOR_GAMUT or ActivityInfo#COLOR_MODE_HDR.; Sets the requested color mode of the window.

Container

Return the container for this Window.; Set the container for this window.

ContentScene

Retrieve the Scene representing this window's current content.

Context

Return the Context this window policy is running in, for retrieving resources and other information.

CurrentFocus

Return the view in this Window that currently has focus, or null if there are none.

DecorView

Retrieve the top-level window decor view (containing the standard window frame/decorations and the client's content inside of that), which can be added as a window to the window manager.

DesiredHdrHeadroom

Get the desired amount of HDR headroom as set by #setDesiredHdrHeadroom(float); Sets the desired amount of HDR headroom to be used when rendering as a ratio of targetHdrPeakBrightnessInNits / targetSdrWhitePointInNits.

EnterTransition

Returns the transition used to move Views into the initial scene.; Sets the Transition that will be used to move Views into the initial scene.

ExitTransition

Returns the Transition that will be used to move Views out of the scene when starting a new Activity.; Sets the Transition that will be used to move Views out of the scene when starting a new Activity.

Features

Return the feature bits that are enabled.

ForcedWindowFlags

Return the window flags that have been explicitly set by the client, so will not be modified by #getDecorView.

FrameRateBoostOnTouchEnabled

Get whether frame rate touch boost is enabled #setFrameRateBoostOnTouchEnabled(boolean); Sets whether the frame rate touch boost is enabled for this Window.

FrameRatePowerSavingsBalanced

Get whether frameratepowersavingsbalance is enabled for this Window.; Set whether frameratepowersavingsbalance is enabled for this Window.

Handle

The handle to the underlying Android instance.

(Inherited from Object)
HasChildren

Indicates whether this window has child windows.

HasSoftInputMode

Has the app specified their own soft input mode?

InsetsController

The WindowInsetsController associated with this window. This value may be null .

IsActive

Indicates whether this window is the active window.

IsFloating

Return whether this window is being displayed with a floating style (based on the WindowIsFloating attribute in the style/theme).

IsWideColorGamut

Returns true if this window's color mode is ActivityInfo#COLOR_MODE_WIDE_COLOR_GAMUT, the display has a wide color gamut and this device supports wide color gamut rendering.

JniIdentityHashCode

Gets the identity hash code assigned to this Java peer by the interop runtime.

(Inherited from Object)
JniManagedPeerState (Inherited from JavaObject)
JniPeerMembers

Gets the JNI peer metadata used by the .NET for Android binding runtime.

LayoutInflater

Quick access to the LayoutInflater instance that this Window retrieved from its Context.

LocalFeatures

Return the feature bits that are being implemented by this Window.

MediaController

Gets or sets the MediaController that was previously set.

NavigationBarColor

Gets the color used for this window's navigation bar.

NavigationBarContrastEnforced

Returns whether the system is ensuring that the navigation bar has enough contrast when a fully transparent background is requested.; Sets whether the system should ensure that the navigation bar has enough contrast when a fully transparent background is requested.

NavigationBarDividerColor

Retrieves the color of the navigation bar divider.; Shows a thin line of the specified color between the navigation bar and the app content.

OnBackInvokedDispatcher

Returns the OnBackInvokedDispatcher instance associated with this window.

PeerReference

Gets the JNI object reference for this Java peer.

(Inherited from Object)
ReenterTransition

Returns the Transition that will be used to move Views in to the scene when returning from a previously-started Activity.; Sets the Transition that will be used to move Views in to the scene when returning from a previously-started Activity.

ReturnTransition

Returns the Transition that will be used to move Views out of the scene when the Window is preparing to close, for example after a call to android.app.Activity#finishAfterTransition().; Sets the Transition that will be used to move Views out of the scene when the Window is preparing to close, for example after a call to android.app.Activity#finishAfterTransition().

RootSurfaceControl

This will be null before a content view is added, e.

SharedElementEnterTransition

Returns the Transition that will be used for shared elements transferred into the content Scene.; Sets the Transition that will be used for shared elements transferred into the content Scene.

SharedElementExitTransition

Returns the Transition to use for shared elements in the launching Window prior to transferring to the launched Activity's Window.; Sets the Transition that will be used for shared elements after starting a new Activity before the shared elements are transferred to the called Activity.

SharedElementReenterTransition

Returns the Transition that will be used for shared elements reentering from a started Activity after it has returned the shared element to it start location.; Sets the Transition that will be used for shared elements reentering from a started Activity after it has returned the shared element to it start location.

SharedElementReturnTransition

Returns the Transition that will be used for shared elements transferred back to a calling Activity.; Sets the Transition that will be used for shared elements transferred back to a calling Activity.

SharedElementsUseOverlay

Returns true when shared elements should use an Overlay during shared element transitions or false when they should animate as part of the normal View hierarchy.; Sets whether or not shared elements should use an Overlay during shared element transitions.

StatusBarColor

Gets the color used for this window's status bar.

StatusBarContrastEnforced

Returns whether the system is ensuring that the status bar has enough contrast when a fully transparent background is requested.; Sets whether the system should ensure that the status bar has enough contrast when a fully transparent background is requested.

SystemGestureExclusionRects

Retrieve the list of areas within this window's coordinate space where the system should not intercept touch or other pointing device gestures.; Sets a list of areas within this window's coordinate space where the system should not intercept touch or other pointing device gestures.

ThresholdClass

Gets the JNI class handle used by the .NET for Android binding runtime.

ThresholdType

Gets the managed type used by the .NET for Android binding runtime.

TransitionBackgroundFadeDuration

Returns the duration, in milliseconds, of the window background fade when transitioning into or away from an Activity when called with an Activity Transition.; Sets the duration, in milliseconds, of the window background fade when transitioning into or away from an Activity when called with an Activity Transition.

TransitionManager

Retrieve the TransitionManager responsible for for default transitions in this window.; Set the TransitionManager to use for default transitions in this window.

VolumeControlStream

Gets or sets the audio stream controlled by this window's volume keys.

WindowManager

Return the window manager allowing this Window to display its own windows.

WindowStyle

Return the android.R.styleable#Window attributes from this window's theme.

Methods

Name Description
AddContentView(View, ViewGroup+LayoutParams)

Variation on #setContentView(View, android.view.ViewGroup.LayoutParams) to add an additional content view to the screen.

AddFlags(WindowManagerFlags)

Convenience function to set the flag bits as specified in flags, as per #setFlags.

AddOnFrameMetricsAvailableListener(Window+IOnFrameMetricsAvailableListener, Handler)

Set an observer to collect frame stats for each frame rendered in this window.

ClearFlags(WindowManagerFlags)

Convenience function to clear the flag bits as specified in flags, as per #setFlags.

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
CloseAllPanels()

Closes every open panel in this window.

ClosePanel(Int32)

Closes the panel identified by the feature ID.

Construct(JniObjectReference, JniObjectReferenceOptions) (Inherited from JavaObject)
Dispose()

Releases the resources held by this Java peer.

(Inherited from Object)
Dispose(Boolean)

Releases the resources held by this Java peer.

(Inherited from Object)
DisposeUnlessReferenced() (Inherited from JavaObject)
Equals(Object) (Inherited from JavaObject)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
FindViewById(Int32)

Finds a view that was identified by the android:id XML attribute that was processed in android.app.Activity#onCreate.

FindViewById<T>(Int32)

Finds the view with the specified ID as the requested type.

GetDefaultFeatures(Context)

Return the feature bits set by default on a window.

GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
HasFeature(WindowFeatures)

Query for the availability of a certain feature.

InjectInputEvent(InputEvent)

Inject an event to window locally.

InvalidatePanelMenu(WindowFeatures)

Requests that the menu for a panel be recreated.

IsShortcutKey(Keycode, KeyEvent)

Is a keypress one of the defined shortcut keys for this window.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
MakeActive()

Makes this window the active window.

Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
OnActive()

Called after this window becomes active.

OnConfigurationChanged(Configuration)

Should be called when the configuration is changed.

OpenPanel(Int32, KeyEvent)

Opens the panel identified by the feature ID.

PeekDecorView()

Retrieve the current decor view, but only if it has already been created; otherwise returns null.

PerformContextMenuIdentifierAction(Int32, MenuPerformFlags)

Performs a context-menu action identified by an item ID.

PerformPanelIdentifierAction(Int32, Int32, MenuPerformFlags)

Performs a panel-menu action identified by an item ID.

PerformPanelShortcut(Int32, Keycode, KeyEvent, MenuPerformFlags)

Performs the panel shortcut associated with a key event.

RegisterScrollCaptureCallback(IScrollCaptureCallback)

Used to provide scroll capture support for an arbitrary window.

RemoveOnFrameMetricsAvailableListener(Window+IOnFrameMetricsAvailableListener)

Remove observer and stop listening to frame stats for this window.

RequestFeature(WindowFeatures)

Enable extended screen features.

RequireViewById(Int32)

Finds a view that was identified by the android:id XML attribute that was processed in android.app.Activity#onCreate, or throws an IllegalArgumentException if the ID is invalid, or there is no matching view in the hierarchy.

RestoreHierarchyState(Bundle)

Restores this window's hierarchy state from a bundle.

SaveHierarchyState()

Saves this window's hierarchy state to a bundle.

SetBackgroundBlurRadius(Int32)

Blurs the screen behind the window within the bounds of the window.

SetBackgroundDrawable(Drawable)

Change the background of this window to a custom Drawable.

SetBackgroundDrawableResource(Int32)

Change the background of this window to a Drawable resource.

SetChildDrawable(Int32, Drawable)

Associates a drawable with a window feature.

SetChildInt(Int32, Int32)

Associates an integer value with a window feature.

SetClipToOutline(Boolean)

Sets whether window content should be clipped to the outline of the window background.

SetContentView(Int32)

Convenience for #setContentView(View, android.view.ViewGroup.LayoutParams) to set the screen content from a layout resource.

SetContentView(View, ViewGroup+LayoutParams)

Convenience for #setContentView(View, android.view.ViewGroup.LayoutParams) to set the screen content from a layout resource.

SetContentView(View)

Convenience for #setContentView(View, android.view.ViewGroup.LayoutParams) set the screen content to an explicit view.

SetDecorCaptionShade(DecorCaptionShade)

Set what color should the caption controls be.

SetDecorFitsSystemWindows(Boolean)

Sets whether the decor view should fit root-level content views for WindowInsets.

SetDefaultWindowFormat(Int32)

Set the default format of window, as per the PixelFormat types.

SetDimAmount(Single)

Set the amount of dim behind the window when using WindowManager.LayoutParams#FLAG_DIM_BEHIND.

SetElevation(Single)

Sets the window elevation. Changes to this property take effect immediately and will cause the window surface to be recreated. This is an expensive operation and as a result, this property should not be animated.

SetFeatureDrawable(WindowFeatures, Drawable)

Set an explicit Drawable value for feature of this window.

SetFeatureDrawableAlpha(WindowFeatures, Int32)

Set a custom alpha value for the given drawable feature, controlling how much the background is visible through it.

SetFeatureDrawableResource(WindowFeatures, Int32)

Set the value for a drawable feature of this window, from a resource identifier.

SetFeatureDrawableUri(WindowFeatures, Uri)

Set the value for a drawable feature of this window, from a URI.

SetFeatureInt(WindowFeatures, Int32)

Set the integer value for a feature.

SetFlags(WindowManagerFlags, WindowManagerFlags)

Set the flags of the window, as per the WindowManager.LayoutParams WindowManager.LayoutParams flags.

SetFormat(Format)

Set the format of window, as per the PixelFormat types.

SetGravity(GravityFlags)

Set the gravity of the window, as per the Gravity constants.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetHideOverlayWindows(Boolean)

Prevent non-system overlay windows from being drawn on top of this window.

SetIcon(Int32)

Set the primary icon for this window.

SetLayout(Int32, Int32)

Set the width and height layout parameters of the window.

SetLocalFocus(Boolean, Boolean)

Set focus locally.

SetLogo(Int32)

Set the logo for this window.

SetNavigationBarColor(Color)

Sets the navigation bar color for this window.

SetPeerReference(JniObjectReference, JniObjectReferenceOptions) (Inherited from JavaObject)
SetPreferMinimalPostProcessing(Boolean)

If isPreferred is true, this method requests that the connected display does minimal post processing when this window is visible on the screen.

SetResizingCaptionDrawable(Drawable)

Set the drawable that is drawn underneath the caption during the resizing.

SetRestrictedCaptionAreaListener(Window+IOnRestrictedCaptionAreaChangedListener)

Set a callback for changes of area where caption will draw its content.

SetSoftInputMode(SoftInput)

Specify an explicit soft input mode to use for the window, as per WindowManager.LayoutParams#softInputMode WindowManager.LayoutParams.softInputMode.

SetStatusBarColor(Color)

Sets the status bar color for this window.

SetSustainedPerformanceMode(Boolean)

Sets the Sustained Performance requirement for the calling window.

SetTitle(ICharSequence)

Sets a user-facing title for the window.

SetTitle(String)

Sets a user-facing title for the window.

SetTitleColor(Color)
Obsolete.

Sets the color of this window's title text.

SetType(WindowManagerTypes)

Set the type of the window, as per the WindowManager.

SetUiOptions(UiOptions, UiOptions)

Set extra options that will influence the UI for this window.

SetUiOptions(UiOptions)

Set extra options that will influence the UI for this window.

SetWindowAnimations(Int32)

Specify custom animations to use for the window, as per WindowManager.LayoutParams#windowAnimations WindowManager.LayoutParams.windowAnimations.

SetWindowManager(IWindowManager, IBinder, String, Boolean)

Creates and sets the window manager for use by this Window to, for example, display panels.

SetWindowManager(IWindowManager, IBinder, String)

Creates and sets the window manager for use by this Window to, for example, display panels.

SuperDispatchGenericMotionEvent(MotionEvent)

Used by custom windows, such as Dialog, to pass the generic motion event further down the view hierarchy.

SuperDispatchKeyEvent(KeyEvent)

Used by custom windows, such as Dialog, to pass the key press event further down the view hierarchy.

SuperDispatchKeyShortcutEvent(KeyEvent)

Used by custom windows, such as Dialog, to pass the key shortcut press event further down the view hierarchy.

SuperDispatchTouchEvent(MotionEvent)

Used by custom windows, such as Dialog, to pass the touch screen event further down the view hierarchy.

SuperDispatchTrackballEvent(MotionEvent)

Used by custom windows, such as Dialog, to pass the trackball event further down the view hierarchy.

TakeInputQueue(InputQueue+ICallback)

Take ownership of this window's InputQueue.

TakeKeyEvents(Boolean)

Request that key events come to this activity.

TakeSurface(ISurfaceHolderCallback2)

Take ownership of this window's surface.

ToArray<T>()

Creates a managed array from this Java array wrapper.

(Inherited from Object)
TogglePanel(Int32, KeyEvent)

Toggles the visibility of the panel identified by the feature ID.

ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime()

Unregisters this Java peer from the interop runtime.

(Inherited from Object)
UnregisterScrollCaptureCallback(IScrollCaptureCallback)

Unregisters a ScrollCaptureCallback previously registered with this window.

Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Events

Name Description
FrameMetricsAvailable

Occurs when frame metrics are available for a rendered frame.

RestrictedCaptionArea

Occurs when the restricted caption area changes.

Explicit Interface Implementations

Name Description
IJavaPeerable.Disposed() (Inherited from JavaObject)
IJavaPeerable.Finalized() (Inherited from JavaObject)
IJavaPeerable.JniObjectReferenceControlBlock (Inherited from JavaObject)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from JavaObject)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from JavaObject)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from JavaObject)

Extension Methods

Name Description
GetJniTypeName(IJavaPeerable)

Gets the JNI name of the type of the instance self.

JavaAs<TResult>(IJavaPeerable)

Try to coerce self to type TResult, checking that the coercion is valid on the Java side.

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
TryJavaCast<TResult>(IJavaPeerable, TResult)

Try to coerce self to type TResult, checking that the coercion is valid on the Java side.

Applies to