分享

4. Window

 黎可图书馆 2015-01-21
定义顶级窗口外观行为策略的抽象类。这个类的一个实例应该被当成顶级view添加到窗口管理器中。它提供了标准的UI策略,比如背景,标题区域等。

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.

这个抽象类的唯一一个实现类是android.policy.PhoneWindow,如果你需要一个窗体那么就应该实例化这个类。

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.


XML Attributes
Attribute Name Related Method Description
android:windowAllowEnterTransitionOverlap setAllowEnterTransitionOverlap(boolean) Flag indicating whether this Window's transition should overlap with the exiting transition of the calling Activity. 
android:windowAllowReturnTransitionOverlap setAllowReturnTransitionOverlap(boolean) Flag indicating whether this Window's transition should overlap with the exiting transition of the called Activity when the called Activity finishes. 
android:windowEnterTransition setEnterTransition(Transition) Reference to a Transition XML resource defining the desired Transition used to move Views into the initial Window's content Scene. 
android:windowExitTransition setExitTransition(Transition) Reference to a Transition XML resource defining the desired Transition used to move Views out of the Window's content Scene when launching a new Activity. 
android:windowReenterTransition setReenterTransition(Transition) Reference to a Transition XML resource defining the desired Transition used to move Views in to the scene when returning from a previously-started Activity. 
android:windowReturnTransition setReturnTransition(Transition) Reference to a Transition XML resource defining the desired Transition used to move Views out of the scene when the Window is preparing to close. 
android:windowSharedElementEnterTransition setSharedElementEnterTransition(Transition) Reference to a Transition XML resource defining the desired Transition used to move shared elements transferred into the Window's initial content Scene. 
android:windowSharedElementExitTransition setSharedElementExitTransition(Transition) Reference to a Transition XML resource defining the desired Transition used when starting a new Activity to move shared elements prior to transferring to the called Activity. 
android:windowSharedElementReenterTransition setSharedElementReenterTransition(Transition) Reference to a Transition XML resource defining the desired Transition used for shared elements transferred back to a calling Activity. 
android:windowSharedElementReturnTransition setSharedElementReturnTransition(Transition) Reference to a Transition XML resource defining the desired Transition used to move shared elements transferred back to a calling Activity. 
android:windowSharedElementsUseOverlay setSharedElementsUseOverlay(boolean) Indicates whether or not shared elements should use an overlay during transitions. 
android:windowTransitionBackgroundFadeDuration setTransitionBackgroundFadeDuration(long) The duration, in milliseconds, of the window background fade duration when transitioning into or away from an Activity when called with an Activity Transition. 
Public Methods
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 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)
View findViewById(int id)
Finds a view that was identified by the id attribute from the XML that was processed in onCreate(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.
final WindowManager.LayoutParams getAttributes()
Retrieve the current window attributes associated with this panel.
final Window.Callback getCallback()
Return the current Callback interface for this window.
final Window getContainer()
Return the container for this Window.
Scene getContentScene()
Retrieve the Scene representing this window's current content.
final 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.
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.
abstract LayoutInflater getLayoutInflater()
Quick access to the LayoutInflater instance that this Window retrieved from its Context.
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 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()
WindowManager getWindowManager()
Return the window manager allowing this Window to display its own windows.
final TypedArray getWindowStyle()
Return the Window attributes from this window's theme.
final boolean hasChildren()
boolean hasFeature(int feature)
Query for the availability of a certain feature.
void injectInputEvent(InputEvent event)
Inject an event to window locally.
abstract void invalidatePanelMenu(int featureId)
final boolean isActive()
abstract boolean isFloating()
Return whether this window is being displayed with a floating style (based on the windowIsFloating attribute in the style/theme).
abstract boolean isShortcutKey(int keyCode, KeyEvent event)
Is a keypress one of the defined shortcut keys for this window.
final void makeActive()
abstract void onConfigurationChanged(Configuration newConfig)
Should be called when the configuration is changed.
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)
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 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.
void setDimAmount(float amount)
Set the amount of dim behind the window when using FLAG_DIM_BEHIND.
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 drawale 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 .
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.
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 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 .
abstract void setTitle(CharSequence title)
abstract void setTitleColor(int textColor)
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 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.
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)

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多