java.lang.Object | |
↳ | android.view.Window |
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 only existing implementation of this abstract class is android.policy.PhoneWindow, which you should instantiate when needing a Window. Eventually that class will be refactored and a factory method added for creating Window instances without knowing about a particular implementation.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Window.Callback | API from a Window back to its caller. |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | DEFAULT_FEATURES | The default features enabled | |||||||||
int | FEATURE_CONTEXT_MENU | Flag for the context menu. | |||||||||
int | FEATURE_CUSTOM_TITLE | Flag for custom title. | |||||||||
int | FEATURE_INDETERMINATE_PROGRESS | Flag for indeterminate progress | |||||||||
int | FEATURE_LEFT_ICON | Flag for having an icon on the left side of the title bar | |||||||||
int | FEATURE_NO_TITLE | Flag for the "no title" feature, turning off the title at the top of the screen. | |||||||||
int | FEATURE_OPTIONS_PANEL | Flag for the "options panel" feature. | |||||||||
int | FEATURE_PROGRESS | Flag for the progress indicator feature | |||||||||
int | FEATURE_RIGHT_ICON | Flag for having an icon on the right side of the title bar | |||||||||
int | ID_ANDROID_CONTENT | The ID that the main layout in the XML layout file should have. | |||||||||
int | PROGRESS_END | Ending value for the (primary) progress | |||||||||
int | PROGRESS_INDETERMINATE_OFF | Flag for setting the progress bar's indeterminate mode off | |||||||||
int | PROGRESS_INDETERMINATE_ON | Flag for setting the progress bar's indeterminate mode on | |||||||||
int | PROGRESS_SECONDARY_END | Highest possible value for the secondary progress | |||||||||
int | PROGRESS_SECONDARY_START | Lowest possible value for the secondary progress | |||||||||
int | PROGRESS_START | Starting value for the (primary) progress | |||||||||
int | PROGRESS_VISIBILITY_OFF | Flag for setting the progress bar's visibility to GONE | |||||||||
int | PROGRESS_VISIBILITY_ON | Flag for setting the progress bar's visibility to VISIBLE |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Variation on
setContentView(View, android.view.ViewGroup.LayoutParams)
to add an additional content view to the screen. | |||||||||||
Convenience function to set the flag bits as specified in flags, as
per
setFlags(int, int) . | |||||||||||
Convenience function to clear the flag bits as specified in flags, as
per
setFlags(int, int) . | |||||||||||
Finds a view that was identified by the id attribute from the XML that
was processed in
onCreate(Bundle) . | |||||||||||
Retrieve the current window attributes associated with this panel.
| |||||||||||
Return the current Callback interface for this window.
| |||||||||||
Return the container for this Window.
| |||||||||||
Return the Context this window policy is running in, for retrieving
resources and other information.
| |||||||||||
Return the view in this Window that currently has focus, or null if
there are none.
| |||||||||||
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.
| |||||||||||
Quick access to the
LayoutInflater instance that this Window
retrieved from its Context. | |||||||||||
Return the window manager allowing this Window to display its own
windows.
| |||||||||||
Return the
Window attributes from this
window's theme. | |||||||||||
Return whether this window is being displayed with a floating style
(based on the
windowIsFloating attribute in
the style/theme). | |||||||||||
Is a keypress one of the defined shortcut keys for this window.
| |||||||||||
Should be called when the configuration is changed.
| |||||||||||
Retrieve the current decor view, but only if it has already been created;
otherwise returns null.
| |||||||||||
Enable extended screen features.
| |||||||||||
Specify custom window attributes.
| |||||||||||
Change the background of this window to a custom Drawable.
| |||||||||||
Change the background of this window to a Drawable resource.
| |||||||||||
Set the Callback interface for this window, used to intercept key
events and other dynamic operations in the window.
| |||||||||||
Set the container for this window.
| |||||||||||
Convenience for
setContentView(View, android.view.ViewGroup.LayoutParams)
set the screen content to an explicit view. | |||||||||||
Convenience for
setContentView(View, android.view.ViewGroup.LayoutParams)
to set the screen content from a layout resource. | |||||||||||
Set the screen content to an explicit view.
| |||||||||||
Set an explicit Drawable value for feature of this window.
| |||||||||||
Set a custom alpha value for the given drawale feature, controlling how
much the background is visible through it.
| |||||||||||
Set the value for a drawable feature of this window, from a resource
identifier.
| |||||||||||
Set the value for a drawable feature of this window, from a URI.
| |||||||||||
Set the integer value for a feature.
| |||||||||||
Set the flags of the window, as per the
WindowManager.LayoutParams
flags. | |||||||||||
Set the format of window, as per the PixelFormat types.
| |||||||||||
Set the gravity of the window, as per the Gravity constants.
| |||||||||||
Set the width and height layout parameters of the window.
| |||||||||||
Specify an explicit soft input mode to use for the window, as per
WindowManager.LayoutParams.softInputMode . | |||||||||||
Set the type of the window, as per the WindowManager.LayoutParams
types.
| |||||||||||
Specify custom animations to use for the window, as per
WindowManager.LayoutParams.windowAnimations . | |||||||||||
Set the window manager for use by this Window to, for example,
display panels.
| |||||||||||
Used by custom windows, such as Dialog, to pass the key press event
further down the view hierarchy.
| |||||||||||
Used by custom windows, such as Dialog, to pass the touch screen event
further down the view hierarchy.
| |||||||||||
Used by custom windows, such as Dialog, to pass the trackball event
further down the view hierarchy.
| |||||||||||
Take ownership of this window's InputQueue.
| |||||||||||
Request that key events come to this activity.
| |||||||||||
Take ownership of this window's surface.
| |||||||||||
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Return the feature bits that are enabled.
| |||||||||||
Return the window flags that have been explicitly set by the client,
so will not be modified by
getDecorView() . | |||||||||||
Return the feature bits that are being implemented by this Window.
| |||||||||||
Has the app specified their own soft input mode?
| |||||||||||
Set the default format of window, as per the PixelFormat types.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object
|
The default features enabled
Flag for the context menu. This is enabled by default.
Flag for custom title. You cannot combine this feature with other title features.
Flag for indeterminate progress
Flag for having an icon on the left side of the title bar
Flag for the "no title" feature, turning off the title at the top of the screen.
Flag for the "options panel" feature. This is enabled by default.
Flag for the progress indicator feature
Flag for having an icon on the right side of the title bar
The ID that the main layout in the XML layout file should have.
Ending value for the (primary) progress
Flag for setting the progress bar's indeterminate mode off
Flag for setting the progress bar's indeterminate mode on
Highest possible value for the secondary progress
Lowest possible value for the secondary progress
Starting value for the (primary) progress
Flag for setting the progress bar's visibility to GONE
Flag for setting the progress bar's visibility to VISIBLE
Variation on
setContentView(View, android.view.ViewGroup.LayoutParams)
to add an additional content view to the screen. Added after any existing
ones in the screen -- existing views are NOT removed.
view | The desired content to display. |
---|---|
params | Layout parameters for the view. |
Convenience function to set the flag bits as specified in flags, as
per setFlags(int, int)
.
flags | The flag bits to be set. |
---|
Convenience function to clear the flag bits as specified in flags, as
per setFlags(int, int)
.
flags | The flag bits to be cleared. |
---|
Finds a view that was identified by the id attribute from the XML that
was processed in onCreate(Bundle)
. This will
implicitly call getDecorView()
for you, with all of the
associated side-effects.
Retrieve the current window attributes associated with this panel.
Return the current Callback interface for this window.
Return the container for this Window.
Return the Context this window policy is running in, for retrieving resources and other information.
Return the view in this Window that currently has focus, or null if there are none. Note that this does not look in any containing Window.
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.
Note that calling this function for the first time "locks in"
various window characteristics as described in
setContentView(View, android.view.ViewGroup.LayoutParams)
.
Quick access to the LayoutInflater
instance that this Window
retrieved from its Context.
Return the window manager allowing this Window to display its own windows.
Return the Window
attributes from this
window's theme.
Return whether this window is being displayed with a floating style
(based on the windowIsFloating
attribute in
the style/theme).
Should be called when the configuration is changed.
newConfig | The new configuration. |
---|
Retrieve the current decor view, but only if it has already been created; otherwise returns null.
Enable extended screen features. This must be called before
setContentView(). May be called as many times as desired as long as it
is before setContentView(). If not called, no extended features
will be available. You can not turn off a feature once it is requested.
You canot use other title features with FEATURE_CUSTOM_TITLE
.
featureId | The desired features, defined as constants by Window. |
---|
Specify custom window attributes. PLEASE NOTE: the
layout params you give here should generally be from values previously
retrieved with getAttributes()
; you probably do not want to
blindly create and apply your own, since this will blow away any values
set by the framework that you are not interested in.
a | The new window attributes, which will completely override any current values. |
---|
Change the background of this window to a custom Drawable. Setting the background to null will make the window be opaque. To make the window transparent, you can use an empty drawable (for instance a ColorDrawable with the color 0 or the system drawable android:drawable/empty.)
drawable | The new Drawable to use for this window's background. |
---|
Change the background of this window to a Drawable resource. Setting the background to null will make the window be opaque. To make the window transparent, you can use an empty drawable (for instance a ColorDrawable with the color 0 or the system drawable android:drawable/empty.)
resid | The resource identifier of a drawable resource which will be installed as the new background. |
---|
Set the Callback interface for this window, used to intercept key events and other dynamic operations in the window.
callback | The desired Callback interface. |
---|
Set the container for this window. If not set, the DecorWindow operates as a top-level window; otherwise, it negotiates with the container to display itself appropriately.
container | The desired containing Window. |
---|
Convenience for
setContentView(View, android.view.ViewGroup.LayoutParams)
set the screen content to an explicit view. This view is placed
directly into the screen's view hierarchy. It can itself be a complex
view hierarhcy.
view | The desired content to display. |
---|
Convenience for
setContentView(View, android.view.ViewGroup.LayoutParams)
to set the screen content from a layout resource. The resource will be
inflated, adding all top-level views to the screen.
layoutResID | Resource ID to be inflated. |
---|
Set the screen content to an explicit view. This view is placed directly into the screen's view hierarchy. It can itself be a complex view hierarchy.
Note that calling this function "locks in" various characteristics
of the window that can not, from this point forward, be changed: the
features that have been requested with requestFeature(int)
,
and certain window flags as described in setFlags(int, int)
.
view | The desired content to display. |
---|---|
params | Layout parameters for the view. |
Set an explicit Drawable value for feature of this window. You must have called requestFeature(featureId) before calling this function.
featureId | The desired drawable feature to change. Features are constants defined by Window. |
---|---|
drawable | A Drawable object to display. |
Set a custom alpha value for the given drawale feature, controlling how much the background is visible through it.
featureId | The desired drawable feature to change. Features are constants defined by Window. |
---|---|
alpha | The alpha amount, 0 is completely transparent and 255 is completely opaque. |
Set the value for a drawable feature of this window, from a resource identifier. You must have called requestFeauture(featureId) before calling this function.
featureId | The desired drawable feature to change, defined as a constant by Window. |
---|---|
resId | Resource identifier of the desired image. |
Set the value for a drawable feature of this window, from a URI. You must have called requestFeature(featureId) before calling this function.
The only URI currently supported is "content:", specifying an image in a content provider.
featureId | The desired drawable feature to change. Features are constants defined by Window. |
---|---|
uri | The desired URI. |
Set the integer value for a feature. The range of the value depends on the feature being set. For FEATURE_PROGRESSS, it should go from 0 to 10000. At 10000 the progress is complete and the indicator hidden.
featureId | The desired feature to change. Features are constants defined by Window. |
---|---|
value | The value for the feature. The interpretation of this value is feature-specific. |
Set the flags of the window, as per the
WindowManager.LayoutParams
flags.
Note that some flags must be set before the window decoration is
created (by the first call to
setContentView(View, android.view.ViewGroup.LayoutParams)
or
getDecorView()
:
FLAG_LAYOUT_IN_SCREEN
and
FLAG_LAYOUT_INSET_DECOR
. These
will be set for you based on the windowIsFloating
attribute.
flags | The new window flags (see WindowManager.LayoutParams). |
---|---|
mask | Which of the window flag bits to modify. |
Set the format of window, as per the PixelFormat types. This overrides the default format that is selected by the Window based on its window decorations.
format | The new window format (see PixelFormat). Use PixelFormat.UNKNOWN to allow the Window to select the format. |
---|
Set the gravity of the window, as per the Gravity constants. This controls how the window manager is positioned in the overall window; it is only useful when using WRAP_CONTENT for the layout width or height.
gravity | The desired gravity constant. |
---|
Set the width and height layout parameters of the window. The default for both of these is MATCH_PARENT; you can change them to WRAP_CONTENT to make a window that is not full-screen.
width | The desired layout width of the window. |
---|---|
height | The desired layout height of the window. |
Specify an explicit soft input mode to use for the window, as per
WindowManager.LayoutParams.softInputMode
. Providing anything besides
"unspecified" here will override the input mode the window would
normally retrieve from its theme.
Set the type of the window, as per the WindowManager.LayoutParams types.
type | The new window type (see WindowManager.LayoutParams). |
---|
Specify custom animations to use for the window, as per
WindowManager.LayoutParams.windowAnimations
. Providing anything besides
0 here will override the animations the window would
normally retrieve from its theme.
Set the window manager for use by this Window to, for example, display panels. This is not used for displaying the Window itself -- that must be done by the client.
wm | The ViewManager for adding new windows. |
---|
Used by custom windows, such as Dialog, to pass the key press event further down the view hierarchy. Application developers should not need to implement or call this.
Used by custom windows, such as Dialog, to pass the touch screen event further down the view hierarchy. Application developers should not need to implement or call this.
Used by custom windows, such as Dialog, to pass the trackball event further down the view hierarchy. Application developers should not need to implement or call this.
Take ownership of this window's InputQueue. The window will no longer read and dispatch input events from the queue; it is your responsibility to do so.
Request that key events come to this activity. Use this if your activity has no views with focus, but the activity still wants a chance to process key events.
Take ownership of this window's surface. The window's view hierarchy will no longer draw into the surface, though it will otherwise continue to operate (such as for receiving input events). The given SurfaceHolder callback will be used to tell you about state changes to the surface.
Return the feature bits that are enabled. This is the set of features that were given to requestFeature(), and are being handled by this Window itself or its container. That is, it is the set of requested features that you can actually use.
To do: add a public version of this API that allows you to check for features by their feature ID.
Return the window flags that have been explicitly set by the client,
so will not be modified by getDecorView()
.
Return the feature bits that are being implemented by this Window. This is the set of features that were given to requestFeature(), and are being handled by only this Window itself, not by its containers.
Has the app specified their own soft input mode?
Set the default format of window, as per the PixelFormat types. This is the format that will be used unless the client specifies in explicit format with setFormat();
format | The new window format (see PixelFormat). |
---|