共用方式為


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
Window
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

Window(Context)
Window(IntPtr, JniHandleOwnership)

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

Fields

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

AllowEnterTransitionOverlap

Returns how the transition set in #setEnterTransition(android.transition.Transition) overlaps with the exit transition of the calling Activity. -or- 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. -or- 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. -or- Specify custom window attributes.

Callback

Return the current Callback interface for this window. -or- 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. -or- Sets the requested color mode of the window.

Container

Return the container for this Window. -or- 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.

EnterTransition

Returns the transition used to move Views into the initial scene. -or- 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. -or- 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.

Handle

The handle to the underlying Android instance.

(Inherited from Object)
HasChildren
HasSoftInputMode

Has the app specified their own soft input mode?

InsetsController
IsActive
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 (Inherited from Object)
JniPeerMembers
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 the MediaController that was previously set. -or- Sets a MediaController to send media keys and volume changes to.

NavigationBarColor
NavigationBarContrastEnforced

Returns whether the system is ensuring that the navigation bar has enough contrast when a fully transparent background is requested. -or- 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. -or- 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 (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. -or- 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(). -or- 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. -or- 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. -or- 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. -or- 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. -or- 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. -or- Sets whether or not shared elements should use an Overlay during shared element transitions.

StatusBarColor
StatusBarContrastEnforced

Returns whether the system is ensuring that the status bar has enough contrast when a fully transparent background is requested. -or- 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. -or- Sets a list of areas within this window's coordinate space where the system should not intercept touch or other pointing device gestures.

ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

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. -or- 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. -or- Set the TransitionManager to use for default transitions in this window.

VolumeControlStream
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

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()
ClosePanel(Int32)
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
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)
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)
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()
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()
OnConfigurationChanged(Configuration)

Should be called when the configuration is changed.

OpenPanel(Int32, KeyEvent)
PeekDecorView()

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

PerformContextMenuIdentifierAction(Int32, MenuPerformFlags)
PerformPanelIdentifierAction(Int32, Int32, MenuPerformFlags)
PerformPanelShortcut(Int32, Keycode, KeyEvent, MenuPerformFlags)
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)
SaveHierarchyState()
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)
SetChildInt(Int32, Int32)
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.

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 color of the navigation bar to .

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 color of the status bar to color.

SetSustainedPerformanceMode(Boolean)
SetTitle(ICharSequence)
SetTitle(String)
SetTitleColor(Color)
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)

Set the window manager for use by this Window to, for example, display panels.

SetWindowManager(IWindowManager, IBinder, String)

Set 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>() (Inherited from Object)
TogglePanel(Int32, KeyEvent)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (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

FrameMetricsAvailable
RestrictedCaptionArea

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to