public abstract class Window extends Object
The only existing implementation of this abstract class is android.view.PhoneWindow, which you should instantiate when needing a Window.
Modifier and Type | Class and Description |
---|---|
static interface |
Window.Callback
API from a Window back to its caller.
|
static interface |
Window.OnFrameMetricsAvailableListener
Callback for clients that want frame timing information for each
frame rendered by the Window.
|
static interface |
Window.OnRestrictedCaptionAreaChangedListener
Callback for clients that want to be aware of where caption draws content.
|
static interface |
Window.OnWindowDismissedCallback |
static interface |
Window.WindowControllerCallback |
Modifier and Type | Field and Description |
---|---|
static int |
DECOR_CAPTION_SHADE_AUTO
Flag for letting the theme drive the color of the window caption controls.
|
static int |
DECOR_CAPTION_SHADE_DARK
Flag for setting dark-color controls on the window caption.
|
static int |
DECOR_CAPTION_SHADE_LIGHT
Flag for setting light-color controls on the window caption.
|
protected static int |
DEFAULT_FEATURES
Deprecated.
use
getDefaultFeatures(android.content.Context) instead. |
static int |
FEATURE_ACTION_BAR
Flag for enabling the Action Bar.
|
static int |
FEATURE_ACTION_BAR_OVERLAY
Flag for requesting an Action Bar that overlays window content.
|
static int |
FEATURE_ACTION_MODE_OVERLAY
Flag for specifying the behavior of action modes when an Action Bar is not present.
|
static int |
FEATURE_ACTIVITY_TRANSITIONS
Enables Activities to run Activity Transitions either through sending or receiving
ActivityOptions bundle created with
ActivityOptions.makeSceneTransitionAnimation(android.app.Activity,
android.util.Pair[]) or ActivityOptions.makeSceneTransitionAnimation(
android.app.Activity, View, String) . |
static int |
FEATURE_CONTENT_TRANSITIONS
Flag for requesting that window content changes should be animated using a
TransitionManager.
|
static int |
FEATURE_CONTEXT_MENU
Flag for the context menu.
|
static int |
FEATURE_CUSTOM_TITLE
Flag for custom title.
|
static int |
FEATURE_INDETERMINATE_PROGRESS
Deprecated.
No longer supported starting in API 21.
|
static int |
FEATURE_LEFT_ICON
Flag for having an icon on the left side of the title bar
|
static int |
FEATURE_MAX
Max value used as a feature ID
|
static int |
FEATURE_NO_TITLE
Flag for the "no title" feature, turning off the title at the top
of the screen.
|
static int |
FEATURE_OPTIONS_PANEL
Flag for the "options panel" feature.
|
static int |
FEATURE_PROGRESS
Deprecated.
No longer supported starting in API 21.
|
static int |
FEATURE_RIGHT_ICON
Flag for having an icon on the right side of the title bar
|
static int |
FEATURE_SWIPE_TO_DISMISS
Flag for requesting a decoration-free window that is dismissed by swiping from the left.
|
static int |
ID_ANDROID_CONTENT
The ID that the main layout in the XML layout file should have.
|
static String |
NAVIGATION_BAR_BACKGROUND_TRANSITION_NAME
The transitionName for the navigation bar background View when a custom background is used.
|
static int |
PROGRESS_END
Deprecated.
FEATURE_PROGRESS and related methods are no longer
supported starting in API 21. |
static int |
PROGRESS_INDETERMINATE_OFF
Deprecated.
FEATURE_INDETERMINATE_PROGRESS and related methods
are no longer supported starting in API 21. |
static int |
PROGRESS_INDETERMINATE_ON
Deprecated.
FEATURE_INDETERMINATE_PROGRESS and related methods
are no longer supported starting in API 21. |
static int |
PROGRESS_SECONDARY_END
Deprecated.
FEATURE_PROGRESS and related methods are no longer
supported starting in API 21. |
static int |
PROGRESS_SECONDARY_START
Deprecated.
FEATURE_PROGRESS and related methods are no longer
supported starting in API 21. |
static int |
PROGRESS_START
Deprecated.
FEATURE_PROGRESS and related methods are no longer
supported starting in API 21. |
static int |
PROGRESS_VISIBILITY_OFF
Deprecated.
FEATURE_PROGRESS and related methods are no longer
supported starting in API 21. |
static int |
PROGRESS_VISIBILITY_ON
Deprecated.
FEATURE_PROGRESS and related methods are no longer
supported starting in API 21. |
static String |
STATUS_BAR_BACKGROUND_TRANSITION_NAME
The transitionName for the status bar background View when a custom background is used.
|
Modifier and Type | Method and Description |
---|---|
abstract void |
addContentView(View view,
ViewGroup.LayoutParams params)
Variation on
setContentView(View, android.view.ViewGroup.LayoutParams)
to add an additional content view to the screen. |
void |
addFlags(int flags)
Convenience function to set the flag bits as specified in flags, as
per
setFlags(int, int) . |
void |
addOnFrameMetricsAvailableListener(Window.OnFrameMetricsAvailableListener listener,
Handler handler)
Set an observer to collect frame stats for each frame rendererd in this window.
|
void |
addPrivateFlags(int flags) |
abstract void |
alwaysReadCloseOnTouchAttr() |
abstract void |
clearContentView()
Remove the view that was used as the screen content.
|
void |
clearFlags(int flags)
Convenience function to clear the flag bits as specified in flags, as
per
setFlags(int, int) . |
abstract void |
closeAllPanels() |
abstract void |
closePanel(int featureId) |
void |
destroy() |
void |
dispatchOnWindowDismissed(boolean finishTask) |
protected void |
dispatchWindowAttributesChanged(WindowManager.LayoutParams attrs) |
View |
findViewById(int id)
Finds a view that was identified by the id attribute from the XML that
was processed in
Activity.onCreate(android.os.Bundle) . |
boolean |
getAllowEnterTransitionOverlap()
Returns how the transition set in
setEnterTransition(android.transition.Transition) overlaps with the exit
transition of the calling Activity. |
boolean |
getAllowReturnTransitionOverlap()
Returns how the transition set in
setExitTransition(android.transition.Transition) overlaps with the exit
transition of the called Activity when reentering after if finishes. |
WindowManager.LayoutParams |
getAttributes()
Retrieve the current window attributes associated with this panel.
|
Window.Callback |
getCallback()
Return the current Callback interface for this window.
|
Window |
getContainer()
Return the container for this Window.
|
Scene |
getContentScene()
Retrieve the
Scene representing this window's current content. |
Context |
getContext()
Return the Context this window policy is running in, for retrieving
resources and other information.
|
abstract View |
getCurrentFocus()
Return the view in this Window that currently has focus, or null if
there are none.
|
abstract View |
getDecorView()
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.
|
static int |
getDefaultFeatures(Context context)
Return the feature bits set by default on a window.
|
float |
getElevation()
Gets the window elevation.
|
Transition |
getEnterTransition()
Returns the transition used to move Views into the initial scene.
|
Transition |
getExitTransition()
Returns the Transition that will be used to move Views out of the scene when starting a
new Activity.
|
protected int |
getFeatures()
Return the feature bits that are enabled.
|
protected int |
getForcedWindowFlags()
Return the window flags that have been explicitly set by the client,
so will not be modified by
getDecorView() . |
abstract LayoutInflater |
getLayoutInflater()
Quick access to the
LayoutInflater instance that this Window
retrieved from its Context. |
protected int |
getLocalFeatures()
Return the feature bits that are being implemented by this Window.
|
MediaController |
getMediaController()
Gets the
MediaController that was previously set. |
abstract int |
getNavigationBarColor() |
Transition |
getReenterTransition()
Returns the Transition that will be used to move Views in to the scene when returning from
a previously-started Activity.
|
Transition |
getReturnTransition()
Returns he 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
Activity.finishAfterTransition() . |
Transition |
getSharedElementEnterTransition()
Returns the Transition that will be used for shared elements transferred into the content
Scene.
|
Transition |
getSharedElementExitTransition()
Returns the Transition to use for shared elements in the launching Window prior
to transferring to the launched Activity's Window.
|
Transition |
getSharedElementReenterTransition()
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.
|
Transition |
getSharedElementReturnTransition()
Returns the Transition that will be used for shared elements transferred back to a
calling Activity.
|
boolean |
getSharedElementsUseOverlay()
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. |
abstract int |
getStatusBarColor() |
long |
getTransitionBackgroundFadeDuration()
Returns the duration, in milliseconds, of the window background fade
when transitioning into or away from an Activity when called with an Activity Transition.
|
TransitionManager |
getTransitionManager()
Retrieve the
TransitionManager responsible for for default transitions
in this window. |
abstract int |
getVolumeControlStream() |
Window.WindowControllerCallback |
getWindowControllerCallback() |
WindowManager |
getWindowManager()
Return the window manager allowing this Window to display its own
windows.
|
TypedArray |
getWindowStyle()
Return the
android.R.styleable#Window attributes from this
window's theme. |
boolean |
hasChildren() |
boolean |
hasFeature(int feature)
Query for the availability of a certain feature.
|
protected boolean |
hasSoftInputMode()
Has the app specified their own soft input mode?
|
protected boolean |
haveDimAmount() |
void |
injectInputEvent(InputEvent event)
Inject an event to window locally.
|
abstract void |
invalidatePanelMenu(int featureId) |
boolean |
isActive() |
boolean |
isDestroyed() |
abstract boolean |
isFloating()
Return whether this window is being displayed with a floating style
(based on the
android.R.attr#windowIsFloating attribute in
the style/theme). |
boolean |
isOverlayWithDecorCaptionEnabled() |
abstract boolean |
isShortcutKey(int keyCode,
KeyEvent event)
Is a keypress one of the defined shortcut keys for this window.
|
void |
makeActive() |
void |
notifyRestrictedCaptionAreaCallback(int left,
int top,
int right,
int bottom) |
protected abstract void |
onActive() |
abstract void |
onConfigurationChanged(Configuration newConfig)
Should be called when the configuration is changed.
|
abstract void |
onMultiWindowModeChanged()
Called when the activity changes from fullscreen mode to multi-window mode and visa-versa.
|
abstract void |
openPanel(int featureId,
KeyEvent event) |
abstract View |
peekDecorView()
Retrieve the current decor view, but only if it has already been created;
otherwise returns null.
|
abstract boolean |
performContextMenuIdentifierAction(int id,
int flags) |
abstract boolean |
performPanelIdentifierAction(int featureId,
int id,
int flags) |
abstract boolean |
performPanelShortcut(int featureId,
int keyCode,
KeyEvent event,
int flags) |
protected void |
removeFeature(int featureId) |
void |
removeOnFrameMetricsAvailableListener(Window.OnFrameMetricsAvailableListener listener)
Remove observer and stop listening to frame stats for this window.
|
abstract void |
reportActivityRelaunched()
Called when the activity just relaunched.
|
boolean |
requestFeature(int featureId)
Enable extended screen features.
|
abstract void |
restoreHierarchyState(Bundle savedInstanceState) |
abstract Bundle |
saveHierarchyState() |
void |
setAllowEnterTransitionOverlap(boolean allow)
Controls how the transition set in
setEnterTransition(android.transition.Transition) overlaps with the exit
transition of the calling Activity. |
void |
setAllowReturnTransitionOverlap(boolean allow)
Controls how the transition set in
setExitTransition(android.transition.Transition) overlaps with the exit
transition of the called Activity when reentering after if finishes. |
void |
setAttributes(WindowManager.LayoutParams a)
Specify custom window attributes.
|
abstract void |
setBackgroundDrawable(Drawable drawable)
Change the background of this window to a custom Drawable.
|
void |
setBackgroundDrawableResource(int resId)
Change the background of this window to a Drawable resource.
|
void |
setCallback(Window.Callback callback)
Set the Callback interface for this window, used to intercept key
events and other dynamic operations in the window.
|
abstract void |
setChildDrawable(int featureId,
Drawable drawable) |
abstract void |
setChildInt(int featureId,
int value) |
void |
setClipToOutline(boolean clipToOutline)
Sets whether window content should be clipped to the outline of the
window background.
|
void |
setCloseOnTouchOutside(boolean close) |
void |
setCloseOnTouchOutsideIfNotSet(boolean close) |
void |
setContainer(Window container)
Set the container for this window.
|
abstract void |
setContentView(int layoutResID)
Convenience for
setContentView(View, android.view.ViewGroup.LayoutParams)
to set the screen content from a layout resource. |
abstract void |
setContentView(View view)
Convenience for
setContentView(View, android.view.ViewGroup.LayoutParams)
set the screen content to an explicit view. |
abstract void |
setContentView(View view,
ViewGroup.LayoutParams params)
Set the screen content to an explicit view.
|
abstract void |
setDecorCaptionShade(int decorCaptionShade)
Set what color should the caption controls be.
|
void |
setDefaultIcon(int resId)
Set the default icon for this window.
|
void |
setDefaultLogo(int resId)
Set the default logo for this window.
|
protected void |
setDefaultWindowFormat(int format)
Set the default format of window, as per the PixelFormat types.
|
void |
setDimAmount(float amount)
Set the amount of dim behind the window when using
WindowManager.LayoutParams.FLAG_DIM_BEHIND . |
void |
setDisableWallpaperTouchEvents(boolean disable) |
void |
setElevation(float elevation)
Sets the window elevation.
|
void |
setEnterTransition(Transition transition)
Sets the Transition that will be used to move Views into the initial scene.
|
void |
setExitTransition(Transition transition)
Sets the Transition that will be used to move Views out of the scene when starting a
new Activity.
|
abstract void |
setFeatureDrawable(int featureId,
Drawable drawable)
Set an explicit Drawable value for feature of this window.
|
abstract void |
setFeatureDrawableAlpha(int featureId,
int alpha)
Set a custom alpha value for the given drawable feature, controlling how
much the background is visible through it.
|
abstract void |
setFeatureDrawableResource(int featureId,
int resId)
Set the value for a drawable feature of this window, from a resource
identifier.
|
abstract void |
setFeatureDrawableUri(int featureId,
Uri uri)
Set the value for a drawable feature of this window, from a URI.
|
abstract void |
setFeatureInt(int featureId,
int value)
Set the integer value for a feature.
|
void |
setFlags(int flags,
int mask)
Set the flags of the window, as per the
WindowManager.LayoutParams
flags. |
void |
setFormat(int format)
Set the format of window, as per the PixelFormat types.
|
void |
setGravity(int gravity)
Set the gravity of the window, as per the Gravity constants.
|
void |
setIcon(int resId)
Set the primary icon for this window.
|
void |
setLayout(int width,
int height)
Set the width and height layout parameters of the window.
|
void |
setLocalFocus(boolean hasFocus,
boolean inTouchMode)
Set focus locally.
|
void |
setLogo(int resId)
Set the logo for this window.
|
void |
setMediaController(MediaController controller)
Sets a
MediaController to send media keys and volume changes to. |
abstract void |
setNavigationBarColor(int color)
Sets the color of the navigation bar to .
|
protected void |
setNeedsMenuKey(int value) |
void |
setOnWindowDismissedCallback(Window.OnWindowDismissedCallback dcb) |
void |
setOverlayWithDecorCaptionEnabled(boolean enabled)
Whether the caption should be displayed directly on the content rather than push the content
down.
|
void |
setReenterTransition(Transition transition)
Sets the Transition that will be used to move Views in to the scene when returning from
a previously-started Activity.
|
abstract void |
setResizingCaptionDrawable(Drawable drawable)
Set the drawable that is drawn underneath the caption during the resizing.
|
void |
setRestrictedCaptionAreaListener(Window.OnRestrictedCaptionAreaChangedListener listener)
Set a callback for changes of area where caption will draw its content.
|
void |
setReturnTransition(Transition transition)
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
Activity.finishAfterTransition() . |
void |
setSharedElementEnterTransition(Transition transition)
Sets the Transition that will be used for shared elements transferred into the content
Scene.
|
void |
setSharedElementExitTransition(Transition transition)
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.
|
void |
setSharedElementReenterTransition(Transition transition)
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.
|
void |
setSharedElementReturnTransition(Transition transition)
Sets the Transition that will be used for shared elements transferred back to a
calling Activity.
|
void |
setSharedElementsUseOverlay(boolean sharedElementsUseOverlay)
Sets whether or not shared elements should use an Overlay during shared element transitions.
|
void |
setSoftInputMode(int mode)
Specify an explicit soft input mode to use for the window, as per
WindowManager.LayoutParams.softInputMode . |
abstract void |
setStatusBarColor(int color)
Sets the color of the status bar to
color . |
void |
setSustainedPerformanceMode(boolean enable) |
void |
setTheme(int resId) |
abstract void |
setTitle(CharSequence title) |
abstract void |
setTitleColor(int textColor)
Deprecated.
|
void |
setTransitionBackgroundFadeDuration(long fadeDurationMillis)
Sets the duration, in milliseconds, of the window background fade
when transitioning into or away from an Activity when called with an Activity Transition.
|
void |
setTransitionManager(TransitionManager tm)
Set the
TransitionManager to use for default transitions in this window. |
void |
setType(int type)
Set the type of the window, as per the WindowManager.LayoutParams
types.
|
void |
setUiOptions(int uiOptions)
Set extra options that will influence the UI for this window.
|
void |
setUiOptions(int uiOptions,
int mask)
Set extra options that will influence the UI for this window.
|
abstract void |
setVolumeControlStream(int streamType) |
void |
setWindowAnimations(int resId)
Specify custom animations to use for the window, as per
WindowManager.LayoutParams.windowAnimations . |
void |
setWindowControllerCallback(Window.WindowControllerCallback wccb) |
void |
setWindowManager(WindowManager wm,
IBinder appToken,
String appName)
Set the window manager for use by this Window to, for example,
display panels.
|
void |
setWindowManager(WindowManager wm,
IBinder appToken,
String appName,
boolean hardwareAccelerated)
Set the window manager for use by this Window to, for example,
display panels.
|
boolean |
shouldCloseOnTouch(Context context,
MotionEvent event) |
abstract boolean |
superDispatchGenericMotionEvent(MotionEvent event)
Used by custom windows, such as Dialog, to pass the generic motion event
further down the view hierarchy.
|
abstract boolean |
superDispatchKeyEvent(KeyEvent event)
Used by custom windows, such as Dialog, to pass the key press event
further down the view hierarchy.
|
abstract boolean |
superDispatchKeyShortcutEvent(KeyEvent event)
Used by custom windows, such as Dialog, to pass the key shortcut press event
further down the view hierarchy.
|
abstract boolean |
superDispatchTouchEvent(MotionEvent event)
Used by custom windows, such as Dialog, to pass the touch screen event
further down the view hierarchy.
|
abstract boolean |
superDispatchTrackballEvent(MotionEvent event)
Used by custom windows, such as Dialog, to pass the trackball event
further down the view hierarchy.
|
abstract void |
takeInputQueue(InputQueue.Callback callback)
Take ownership of this window's InputQueue.
|
abstract void |
takeKeyEvents(boolean get)
Request that key events come to this activity.
|
abstract void |
takeSurface(SurfaceHolder.Callback2 callback)
Take ownership of this window's surface.
|
abstract void |
togglePanel(int featureId,
KeyEvent event) |
public static final int FEATURE_OPTIONS_PANEL
public static final int FEATURE_NO_TITLE
@Deprecated public static final int FEATURE_PROGRESS
public static final int FEATURE_LEFT_ICON
public static final int FEATURE_RIGHT_ICON
@Deprecated public static final int FEATURE_INDETERMINATE_PROGRESS
public static final int FEATURE_CONTEXT_MENU
public static final int FEATURE_CUSTOM_TITLE
public static final int FEATURE_ACTION_BAR
public static final int FEATURE_ACTION_BAR_OVERLAY
FEATURE_ACTION_BAR
it will be layered over
the window content itself. This is useful if you would like your app to have more control
over how the Action Bar is displayed, such as letting application content scroll beneath
an Action Bar with a transparent background or otherwise displaying a transparent/translucent
Action Bar over application content.
This mode is especially useful with View.SYSTEM_UI_FLAG_FULLSCREEN
, which allows you to seamlessly hide the
action bar in conjunction with other screen decorations.
As of Build.VERSION_CODES.JELLY_BEAN
, when an
ActionBar is in this mode it will adjust the insets provided to
View.fitSystemWindows(Rect)
to include the content covered by the action bar, so you can do layout within
that space.
public static final int FEATURE_ACTION_MODE_OVERLAY
public static final int FEATURE_SWIPE_TO_DISMISS
public static final int FEATURE_CONTENT_TRANSITIONS
The TransitionManager is set using
setTransitionManager(android.transition.TransitionManager)
. If none is set,
a default TransitionManager will be used.
setContentView(int)
,
Constant Field Valuespublic static final int FEATURE_ACTIVITY_TRANSITIONS
ActivityOptions.makeSceneTransitionAnimation(android.app.Activity,
android.util.Pair[])
or ActivityOptions.makeSceneTransitionAnimation(
android.app.Activity, View, String)
.public static final int FEATURE_MAX
@Deprecated public static final int PROGRESS_VISIBILITY_ON
FEATURE_PROGRESS
and related methods are no longer
supported starting in API 21.@Deprecated public static final int PROGRESS_VISIBILITY_OFF
FEATURE_PROGRESS
and related methods are no longer
supported starting in API 21.@Deprecated public static final int PROGRESS_INDETERMINATE_ON
FEATURE_INDETERMINATE_PROGRESS
and related methods
are no longer supported starting in API 21.@Deprecated public static final int PROGRESS_INDETERMINATE_OFF
FEATURE_INDETERMINATE_PROGRESS
and related methods
are no longer supported starting in API 21.@Deprecated public static final int PROGRESS_START
FEATURE_PROGRESS
and related methods are no longer
supported starting in API 21.@Deprecated public static final int PROGRESS_END
FEATURE_PROGRESS
and related methods are no longer
supported starting in API 21.@Deprecated public static final int PROGRESS_SECONDARY_START
FEATURE_PROGRESS
and related methods are no longer
supported starting in API 21.@Deprecated public static final int PROGRESS_SECONDARY_END
FEATURE_PROGRESS
and related methods are no longer
supported starting in API 21.public static final String STATUS_BAR_BACKGROUND_TRANSITION_NAME
setStatusBarColor(int)
,
Constant Field Valuespublic static final String NAVIGATION_BAR_BACKGROUND_TRANSITION_NAME
setNavigationBarColor(int)
,
Constant Field Values@Deprecated protected static final int DEFAULT_FEATURES
getDefaultFeatures(android.content.Context)
instead.public static final int ID_ANDROID_CONTENT
public static final int DECOR_CAPTION_SHADE_AUTO
setDecorCaptionShade(int)
. This is the default value.public static final int DECOR_CAPTION_SHADE_LIGHT
setDecorCaptionShade(int)
.public static final int DECOR_CAPTION_SHADE_DARK
setDecorCaptionShade(int)
.public Window(Context context)
public final Context getContext()
public final TypedArray getWindowStyle()
android.R.styleable#Window
attributes from this
window's theme.public void setContainer(Window container)
container
- The desired containing Window.public final Window getContainer()
public final boolean hasChildren()
public final void destroy()
public final boolean isDestroyed()
public void setWindowManager(WindowManager wm, IBinder appToken, String appName)
wm
- The window manager for adding new windows.public void setWindowManager(WindowManager wm, IBinder appToken, String appName, boolean hardwareAccelerated)
wm
- The window manager for adding new windows.public WindowManager getWindowManager()
public void setCallback(Window.Callback callback)
callback
- The desired Callback interface.public final Window.Callback getCallback()
public final void addOnFrameMetricsAvailableListener(Window.OnFrameMetricsAvailableListener listener, Handler handler)
public final void removeOnFrameMetricsAvailableListener(Window.OnFrameMetricsAvailableListener listener)
public final void setOnWindowDismissedCallback(Window.OnWindowDismissedCallback dcb)
public final void dispatchOnWindowDismissed(boolean finishTask)
public final void setWindowControllerCallback(Window.WindowControllerCallback wccb)
public final Window.WindowControllerCallback getWindowControllerCallback()
public final void setRestrictedCaptionAreaListener(Window.OnRestrictedCaptionAreaChangedListener listener)
listener
- Callback that will be called when the area changes.public abstract void takeSurface(SurfaceHolder.Callback2 callback)
public abstract void takeInputQueue(InputQueue.Callback callback)
public abstract boolean isFloating()
android.R.attr#windowIsFloating
attribute in
the style/theme).public void setLayout(int width, int height)
width
- The desired layout width of the window.height
- The desired layout height of the window.ViewGroup.LayoutParams.height
,
ViewGroup.LayoutParams.width
public void setGravity(int gravity)
gravity
- The desired gravity constant.Gravity
,
setLayout(int, int)
public void setType(int type)
type
- The new window type (see WindowManager.LayoutParams).public void setFormat(int format)
format
- The new window format (see PixelFormat). Use
PixelFormat.UNKNOWN to allow the Window to select
the format.PixelFormat
public void setWindowAnimations(@StyleRes int resId)
WindowManager.LayoutParams.windowAnimations
. Providing anything besides
0 here will override the animations the window would
normally retrieve from its theme.public void setSoftInputMode(int mode)
WindowManager.LayoutParams.softInputMode
. Providing anything besides
"unspecified" here will override the input mode the window would
normally retrieve from its theme.public void addFlags(int flags)
setFlags(int, int)
.flags
- The flag bits to be set.setFlags(int, int)
,
clearFlags(int)
public void addPrivateFlags(int flags)
public void clearFlags(int flags)
setFlags(int, int)
.flags
- The flag bits to be cleared.setFlags(int, int)
,
addFlags(int)
public void setFlags(int flags, int mask)
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()
:
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
and
WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR
. These
will be set for you based on the android.R.attr#windowIsFloating
attribute.
flags
- The new window flags (see WindowManager.LayoutParams).mask
- Which of the window flag bits to modify.addFlags(int)
,
clearFlags(int)
protected void setNeedsMenuKey(int value)
protected void dispatchWindowAttributesChanged(WindowManager.LayoutParams attrs)
public void setDimAmount(float amount)
WindowManager.LayoutParams.FLAG_DIM_BEHIND
. This overrides
the default dim amount of that is selected by the Window based on
its theme.amount
- The new dim amount, from 0 for no dim to 1 for full dim.public void setAttributes(WindowManager.LayoutParams a)
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.public final WindowManager.LayoutParams getAttributes()
protected final int getForcedWindowFlags()
getDecorView()
.protected final boolean hasSoftInputMode()
public void setCloseOnTouchOutside(boolean close)
public void setCloseOnTouchOutsideIfNotSet(boolean close)
public void setDisableWallpaperTouchEvents(boolean disable)
public abstract void alwaysReadCloseOnTouchAttr()
public boolean shouldCloseOnTouch(Context context, MotionEvent event)
public void setSustainedPerformanceMode(boolean enable)
public boolean requestFeature(int featureId)
FEATURE_CUSTOM_TITLE
.featureId
- The desired features, defined as constants by Window.protected void removeFeature(int featureId)
public final void makeActive()
public final boolean isActive()
public View findViewById(@IdRes int id)
Activity.onCreate(android.os.Bundle)
. This will
implicitly call getDecorView()
for you, with all of the
associated side-effects.public abstract void setContentView(@LayoutRes int layoutResID)
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.setContentView(View, android.view.ViewGroup.LayoutParams)
public abstract void setContentView(View view)
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.setContentView(View, android.view.ViewGroup.LayoutParams)
public abstract void setContentView(View view, ViewGroup.LayoutParams params)
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)
.
If FEATURE_CONTENT_TRANSITIONS
is set, the window's
TransitionManager will be used to animate content from the current
content View to view.
view
- The desired content to display.params
- Layout parameters for the view.getTransitionManager()
,
setTransitionManager(android.transition.TransitionManager)
public abstract void addContentView(View view, ViewGroup.LayoutParams params)
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.public abstract void clearContentView()
public abstract View getCurrentFocus()
public abstract LayoutInflater getLayoutInflater()
LayoutInflater
instance that this Window
retrieved from its Context.public abstract void setTitle(CharSequence title)
@Deprecated public abstract void setTitleColor(int textColor)
public abstract void openPanel(int featureId, KeyEvent event)
public abstract void closePanel(int featureId)
public abstract void togglePanel(int featureId, KeyEvent event)
public abstract void invalidatePanelMenu(int featureId)
public abstract boolean performPanelShortcut(int featureId, int keyCode, KeyEvent event, int flags)
public abstract boolean performPanelIdentifierAction(int featureId, int id, int flags)
public abstract void closeAllPanels()
public abstract boolean performContextMenuIdentifierAction(int id, int flags)
public abstract void onConfigurationChanged(Configuration newConfig)
newConfig
- The new configuration.public void setElevation(float 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.
elevation
- The window elevation.View.setElevation(float)
,
android.R.styleable#Window_windowElevation
public float getElevation()
public void setClipToOutline(boolean clipToOutline)
clipToOutline
- Whether window content should be clipped to the
outline of the window background.View.setClipToOutline(boolean)
,
android.R.styleable#Window_windowClipToOutline
public void setBackgroundDrawableResource(@DrawableRes int resId)
resId
- The resource identifier of a drawable resource which will
be installed as the new background.public abstract void setBackgroundDrawable(Drawable drawable)
drawable
- The new Drawable to use for this window's background.public abstract void setFeatureDrawableResource(int featureId, @DrawableRes int resId)
featureId
- The desired drawable feature to change, defined as a
constant by Window.resId
- Resource identifier of the desired image.Resources.getDrawable(int)
public abstract void setFeatureDrawableUri(int featureId, Uri uri)
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.ImageView.setImageURI(android.net.Uri)
public abstract void setFeatureDrawable(int featureId, Drawable drawable)
featureId
- The desired drawable feature to change. Features are
constants defined by Window.drawable
- A Drawable object to display.public abstract void setFeatureDrawableAlpha(int featureId, int alpha)
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.public abstract void setFeatureInt(int featureId, int value)
FEATURE_PROGRESS
, 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.public abstract void takeKeyEvents(boolean get)
public abstract boolean superDispatchKeyEvent(KeyEvent event)
public abstract boolean superDispatchKeyShortcutEvent(KeyEvent event)
public abstract boolean superDispatchTouchEvent(MotionEvent event)
public abstract boolean superDispatchTrackballEvent(MotionEvent event)
public abstract boolean superDispatchGenericMotionEvent(MotionEvent event)
public abstract View getDecorView()
Note that calling this function for the first time "locks in"
various window characteristics as described in
setContentView(View, android.view.ViewGroup.LayoutParams)
.
public abstract View peekDecorView()
getDecorView()
public abstract Bundle saveHierarchyState()
public abstract void restoreHierarchyState(Bundle savedInstanceState)
protected abstract void onActive()
protected final int getFeatures()
To do: add a public version of this API that allows you to check for features by their feature ID.
public static int getDefaultFeatures(Context context)
context
- The context used to access resourcespublic boolean hasFeature(int feature)
feature
- The feature ID to checkprotected final int getLocalFeatures()
protected void setDefaultWindowFormat(int format)
format
- The new window format (see PixelFormat).setFormat(int)
,
PixelFormat
protected boolean haveDimAmount()
public abstract void setChildDrawable(int featureId, Drawable drawable)
public abstract void setChildInt(int featureId, int value)
public abstract boolean isShortcutKey(int keyCode, KeyEvent event)
public abstract void setVolumeControlStream(int streamType)
Activity.setVolumeControlStream(int)
public abstract int getVolumeControlStream()
Activity.getVolumeControlStream()
public void setMediaController(MediaController controller)
MediaController
to send media keys and volume changes to.
If set, this should be preferred for all media keys and volume requests
sent to this window.controller
- The controller for the session which should receive
media keys and volume changes.Activity.setMediaController(android.media.session.MediaController)
public MediaController getMediaController()
MediaController
that was previously set.setMediaController(android.media.session.MediaController)
,
Activity.getMediaController()
public void setUiOptions(int uiOptions)
uiOptions
- Flags specifying extra options for this window.public void setUiOptions(int uiOptions, int mask)
uiOptions
- Flags specifying extra options for this window.mask
- Flags specifying which options should be modified. Others will remain unchanged.public void setIcon(@DrawableRes int resId)
resId
- resource ID of a drawable to setpublic void setDefaultIcon(@DrawableRes int resId)
public void setLogo(@DrawableRes int resId)
icon
but is generally wider and communicates window title information
as well.resId
- resource ID of a drawable to setpublic void setDefaultLogo(@DrawableRes int resId)
public void setLocalFocus(boolean hasFocus, boolean inTouchMode)
WindowManager.LayoutParams.FLAG_LOCAL_FOCUS_MODE
flag set already.hasFocus
- Whether this window has focus or not.inTouchMode
- Whether this window is in touch mode or not.public void injectInputEvent(InputEvent event)
event
- A key or touch event to inject to this window.public TransitionManager getTransitionManager()
TransitionManager
responsible for for default transitions
in this window. Requires FEATURE_CONTENT_TRANSITIONS
.
This method will return non-null after content has been initialized (e.g. by using
setContentView(int)
) if FEATURE_CONTENT_TRANSITIONS
has been granted.
public void setTransitionManager(TransitionManager tm)
TransitionManager
to use for default transitions in this window.
Requires FEATURE_CONTENT_TRANSITIONS
.tm
- The TransitionManager to use for scene changes.public Scene getContentScene()
Scene
representing this window's current content.
Requires FEATURE_CONTENT_TRANSITIONS
.
This method will return null if the current content is not represented by a Scene.
public void setEnterTransition(Transition transition)
ViewGroup.isTransitionGroup()
return true. Typical Transitions will extend
Visibility
as entering is governed by changing visibility from
View.INVISIBLE
to View.VISIBLE
. If transition
is null,
entering Views will remain unaffected.transition
- The Transition to use to move Views into the initial Scene.public void setReturnTransition(Transition transition)
Activity.finishAfterTransition()
. The exiting
Views will be those that are regular Views or ViewGroups that have
ViewGroup.isTransitionGroup()
return true. Typical Transitions will extend
Visibility
as entering is governed by changing visibility from
View.VISIBLE
to View.INVISIBLE
. If transition
is null,
entering Views will remain unaffected. If nothing is set, the default will be to
use the same value as set in setEnterTransition(android.transition.Transition)
.transition
- The Transition to use to move Views out of the Scene when the Window
is preparing to close.public void setExitTransition(Transition transition)
ViewGroup.isTransitionGroup()
return true. Typical Transitions will extend
Visibility
as exiting is governed by changing visibility
from View.VISIBLE
to View.INVISIBLE
. If transition is null, the views will
remain unaffected. Requires FEATURE_ACTIVITY_TRANSITIONS
.transition
- The Transition to use to move Views out of the scene when calling a
new Activity.public void setReenterTransition(Transition transition)
ViewGroup.isTransitionGroup()
return true. Typical Transitions
will extend Visibility
as exiting is governed by changing
visibility from View.VISIBLE
to View.INVISIBLE
. If transition is null,
the views will remain unaffected. If nothing is set, the default will be to use the same
transition as setExitTransition(android.transition.Transition)
.
Requires FEATURE_ACTIVITY_TRANSITIONS
.transition
- The Transition to use to move Views into the scene when reentering from a
previously-started Activity.public Transition getEnterTransition()
ViewGroup.isTransitionGroup()
return true. Typical Transitions will extend
Visibility
as entering is governed by changing visibility from
View.INVISIBLE
to View.VISIBLE
. If transition
is null,
entering Views will remain unaffected. Requires FEATURE_ACTIVITY_TRANSITIONS
.public Transition getReturnTransition()
Activity.finishAfterTransition()
. The exiting
Views will be those that are regular Views or ViewGroups that have
ViewGroup.isTransitionGroup()
return true. Typical Transitions will extend
Visibility
as entering is governed by changing visibility from
View.VISIBLE
to View.INVISIBLE
.public Transition getExitTransition()
ViewGroup.isTransitionGroup()
return true. Typical Transitions will extend
Visibility
as exiting is governed by changing visibility
from View.VISIBLE
to View.INVISIBLE
. If transition is null, the views will
remain unaffected. Requires FEATURE_ACTIVITY_TRANSITIONS
.public Transition getReenterTransition()
ViewGroup.isTransitionGroup()
return true. Typical Transitions
will extend Visibility
as exiting is governed by changing
visibility from View.VISIBLE
to View.INVISIBLE
.
Requires FEATURE_ACTIVITY_TRANSITIONS
.public void setSharedElementEnterTransition(Transition transition)
ChangeBounds
. A null
value will cause transferred shared elements to blink to the final position.
Requires FEATURE_ACTIVITY_TRANSITIONS
.transition
- The Transition to use for shared elements transferred into the content
Scene.public void setSharedElementReturnTransition(Transition transition)
ChangeBounds
. A null
value will cause transferred shared elements to blink to the final position.
If no value is set, the default will be to use the same value as
setSharedElementEnterTransition(android.transition.Transition)
.
Requires FEATURE_ACTIVITY_TRANSITIONS
.transition
- The Transition to use for shared elements transferred out of the content
Scene.public Transition getSharedElementEnterTransition()
FEATURE_ACTIVITY_TRANSITIONS
.public Transition getSharedElementReturnTransition()
FEATURE_ACTIVITY_TRANSITIONS
.public void setSharedElementExitTransition(Transition transition)
FEATURE_ACTIVITY_TRANSITIONS
.transition
- The Transition to use for shared elements in the launching Window
prior to transferring to the launched Activity's Window.public void setSharedElementReenterTransition(Transition transition)
setSharedElementExitTransition(android.transition.Transition)
.
Requires FEATURE_ACTIVITY_TRANSITIONS
.transition
- The Transition to use for shared elements in the launching Window
after the shared element has returned to the Window.public Transition getSharedElementExitTransition()
FEATURE_ACTIVITY_TRANSITIONS
.public Transition getSharedElementReenterTransition()
FEATURE_ACTIVITY_TRANSITIONS
.public void setAllowEnterTransitionOverlap(boolean allow)
setEnterTransition(android.transition.Transition)
overlaps with the exit
transition of the calling Activity. When true, the transition will start as soon as possible.
When false, the transition will wait until the remote exiting transition completes before
starting.allow
- true to start the enter transition when possible or false to
wait until the exiting transition completes.public boolean getAllowEnterTransitionOverlap()
setEnterTransition(android.transition.Transition)
overlaps with the exit
transition of the calling Activity. When true, the transition will start as soon as possible.
When false, the transition will wait until the remote exiting transition completes before
starting.public void setAllowReturnTransitionOverlap(boolean allow)
setExitTransition(android.transition.Transition)
overlaps with the exit
transition of the called Activity when reentering after if finishes. When true,
the transition will start as soon as possible. When false, the transition will wait
until the called Activity's exiting transition completes before starting.allow
- true to start the transition when possible or false to wait until the
called Activity's exiting transition completes.public boolean getAllowReturnTransitionOverlap()
setExitTransition(android.transition.Transition)
overlaps with the exit
transition of the called Activity when reentering after if finishes. When true,
the transition will start as soon as possible. When false, the transition will wait
until the called Activity's exiting transition completes before starting.public long getTransitionBackgroundFadeDuration()
When executing the enter transition, the background starts transparent
and fades in. This requires FEATURE_ACTIVITY_TRANSITIONS
. The default is
300 milliseconds.
getEnterTransition()
public void setTransitionBackgroundFadeDuration(long fadeDurationMillis)
When executing the enter transition, the background starts transparent
and fades in. This requires FEATURE_ACTIVITY_TRANSITIONS
. The default is
300 milliseconds.
fadeDurationMillis
- The duration of the window background fade to or from opaque
during enter transition.setEnterTransition(android.transition.Transition)
public boolean getSharedElementsUseOverlay()
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. The default value is true.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.public void setSharedElementsUseOverlay(boolean sharedElementsUseOverlay)
sharedElementsUseOverlay
- true
indicates that shared elements should
be transitioned with an Overlay or false
to transition within the normal View hierarchy.public abstract int getStatusBarColor()
public abstract void setStatusBarColor(int color)
color
.
For this to take effect,
the window must be drawing the system bar backgrounds with
WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
and
WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
must not be set.
If color
is not opaque, consider setting
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
and
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
.
The transitionName for the view background will be "android:status:background".
public abstract int getNavigationBarColor()
public abstract void setNavigationBarColor(int color)
WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
and
WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION
must not be set.
If is not opaque, consider setting
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
and
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
.
The transitionName for the view background will be "android:navigation:background".
public void setTheme(int resId)
public void setOverlayWithDecorCaptionEnabled(boolean enabled)
public boolean isOverlayWithDecorCaptionEnabled()
public void notifyRestrictedCaptionAreaCallback(int left, int top, int right, int bottom)
public abstract void setDecorCaptionShade(int decorCaptionShade)
DECOR_CAPTION_SHADE_DARK
,
DECOR_CAPTION_SHADE_LIGHT
, or DECOR_CAPTION_SHADE_AUTO
.public abstract void setResizingCaptionDrawable(Drawable drawable)
public abstract void onMultiWindowModeChanged()
public abstract void reportActivityRelaunched()