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.html
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 implementationjava
window是一个抽象基类,负责顶层窗口显示和行为的规则。这个类的一个实例必须被用做顶层的view加入到window manager中。它提供了标准UI规则,例如:背景,标题区域,默认的主进程等等。android
这个抽象类的仅有的一个实现是android.policy.PhoneWindow。当你须要一个窗口window的时候,你须要实例化PhoneWindow。最后,PhoneWindow这个类会使用你不须要知道的特殊实现方式的重构方法进行重构,从而获得一个PhoneWindow对象,也即获得一个窗口。web
Nested Classes内部类 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
interface编程 接口windows |
回调类app |
API from a Window back to its caller. 框架 应用程序编程接口:从窗口window到它的调用者ide |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | DEFAULT_FEATURES窗口默认特征 | The default features enabled 启用 | |||||||||
int | FEATURE_ACTION_BAR | Flag for enabling the Action Bar. | |||||||||
int | FEATURE_ACTION_BAR_OVERLAY | Flag for requesting an Action Bar that overlays window content. | |||||||||
int | FEATURE_ACTION_MODE_OVERLAY | Flag for specifying the behavior of action modes when an Action Bar is not present. | |||||||||
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布局Layout的ID | 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 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Window(Context context)构造方法 |
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.为window添加view,而且指定布局
|
||||||||||
void | addFlags(int flags) 为window添加特定的特征。
Convenience function to set the flag bits as specified in flags, as per
setFlags(int, int) .
|
||||||||||
void | clearFlags(int flags) 清除window的某一特征
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) 经过id获取view。经过onCreate方法中处理的xml文件中标识View的 id,获取view。
Finds a view that was identified by the id attribute from the XML that was processed in
onCreate(Bundle) .
|
||||||||||
final WindowManager.LayoutParams | 获取当前窗口与这个面板相关的属性(布局信息)。
Retrieve the current window attributes associated with this panel.
|
||||||||||
final Window.Callback | 获取这个窗口的回调接口。
Return the current Callback interface for this window.
|
||||||||||
final Window | 获取这个窗口的容器(仍是一个窗口)
Return the container for this Window.
|
||||||||||
final Context | 获取这个正在运行的窗口的上下文信息,从而能够从这些信息中获取到资源和其余的信息。
Return the Context this window policy is running in, for retrieving resources and other information.
|
||||||||||
abstract View | 获取当前窗口中当前获得焦点的view。若是没有任何view获得焦点,则返回空。
Return the view in this Window that currently has focus, or null if there are none.
|
||||||||||
abstract View | 得到修饰view。得到顶层窗口的修饰view(包括标准窗口框架结构,修饰和窗口中的内容)。这个修饰view能够被看成一个window加入到window manager中。
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.
|
||||||||||
abstract LayoutInflater | 得到LayoutInflater实例。这个实例是从窗口从本身的上下文信息中获得的。 |
||||||||||
abstract int | getVolumeControlStream()得到音量控制流 | ||||||||||
WindowManager | 得到这个window的窗口管理器window manager。window manager 容许这个window显示它的windows。
Return the window manager allowing this Window to display its own windows.
|
||||||||||
final TypedArray | 得到窗口主题的窗口属性。 |
||||||||||
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)无效的面板菜单(特征 id) |
||||||||||
final boolean | isActive()是否激活 | ||||||||||
abstract boolean | 是不是悬浮状态
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)打开面板(特征Id,键盘事件) | ||||||||||
abstract View | 得到当前窗口的修饰view:decor view.前提是这个修饰view已经被建立,不然会返回空
Retrieve the current decor view, but only if it has already been created; otherwise returns null.
|
||||||||||
abstract boolean | performContextMenuIdentifierAction(int id, int flags)执行上下为文菜单某一标识的动做(id,标识) | ||||||||||
abstract boolean | performPanelIdentifierAction(int featureId, int id, int flags)执行面板标识动做(特征Id,id,标识) | ||||||||||
abstract boolean | performPanelShortcut(int featureId, int keyCode, KeyEvent event, int flags)执行面板快捷键(特征Id,键码,键盘事件) | ||||||||||
boolean | requestFeature(int featureId) 请求某一扩展的屏幕特征有效(特征Id)
Enable extended screen features.
|
||||||||||
abstract void | restoreHierarchyState(Bundle savedInstanceState)恢复等级状态(保存的实例状态) | ||||||||||
abstract Bundle | saveHierarchyState()保存等级状态 | ||||||||||
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) 设置窗口背景图像资源(资源Id)
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)设置子图片(特征Id,图片) | ||||||||||
abstract void | setChildInt(int featureId, int value)设置子Id(特征Id,值) | ||||||||||
void | setContainer(Window container) 为这个窗口设置容器(容器[本质仍是个窗口])
Set the container for this window.
|
||||||||||
abstract void | setContentView(View view) 设置内容view(view)。这是相对于setContetView(View,LayoutParams)的一个更直接的方法。
Convenience for
setContentView(View, android.view.ViewGroup.LayoutParams)
set the screen content to an explicit view.
|
||||||||||
abstract void | setContentView(int layoutResID) 设置内容view(资源)
Convenience for
setContentView(View, android.view.ViewGroup.LayoutParams)
to set the screen content from a layout resource.
|
||||||||||
abstract void | setContentView(View view, ViewGroup.LayoutParams params) 设置内容view(view,LayoutParams)
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 .
|
||||||||||
abstract void | setFeatureDrawable(int featureId, Drawable drawable)
设置特征图片(特征Id,图片)
Set an explicit Drawable value for feature of this window.
|
||||||||||
abstract void | setFeatureDrawableAlpha(int featureId, int alpha)
设置特征图片透明度(特征Id,透明度)
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) 设置特征图片资源(特征id,资源)
Set the value for a drawable feature of this window, from a resource identifier.
|
||||||||||
abstract void | setFeatureDrawableUri(int featureId, Uri uri) 设置特征图片Uril(特征Id,uri)
Set the value for a drawable feature of this window, from a URI.
|
||||||||||
abstract void | setFeatureInt(int featureId, int value) 设置特征(特征Id,值)
Set the integer value for a feature.
|
||||||||||
void | setFlags(int flags, int mask) 设置window的标记,做为一个WindowManager.LayoutParams的标记。 |
||||||||||
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) 设置Logo(资源)
Set the logo for this window.
|
||||||||||
void | setSoftInputMode(int mode) 设置软输入模式(模式)
Specify an explicit soft input mode to use for the window, as per
WindowManager.LayoutParams.softInputMode .
|
||||||||||
abstract void | setTitle(CharSequence title)设置标题(标题) |
||||||||||
abstract void | setTitleColor(int textColor)设置标题颜色(颜色) | ||||||||||
void | setType(int type) 设置窗口类型(类型),正如每一个窗口布局的类型 Set the type of the window, as per the WindowManager.LayoutParams types. |
||||||||||
void | setUiOptions(int uiOptions) 设置额外的UI操做(UI操做)
Set extra options that will influence the UI for this window.
|
||||||||||
void | setUiOptions(int uiOptions, int mask) 设置额外的UI操做选项(操做,动做掩码)
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, boolean hardwareAccelerated) 设置窗口所用的窗口管理器,如用来显示plane。
Set the window manager for use by this Window to, for example, display panels.
|
||||||||||
void | setWindowManager(WindowManager wm, IBinder appToken, String appName) 设置窗口所用的窗口管理器,如用来显示plane。
Set the window manager for use by this Window to, for example, display panels.
|
||||||||||
abstract boolean | superDispatchGenericMotionEvent(MotionEvent event) 派遣鼠标事件(鼠标事件) 被自定义的window使用,如diaglog。用于将通常的鼠标事件向下传递到view层级中。
Used by custom windows, such as Dialog, to pass the generic motion event further down the view hierarchy.
|
||||||||||
abstract boolean | superDispatchKeyEvent(KeyEvent event) 派遣键盘事件(键盘事件) 被自定义的window使用,如diaglog。用于将通常的按键事件向下传递到view层级中。
Used by custom windows, such as Dialog, to pass the key press event further down the view hierarchy.
|
||||||||||
abstract boolean | superDispatchKeyShortcutEvent(KeyEvent event) 派遣快捷键事件(键盘事件) 被自定义的window使用,如dialog。用于将通常的键盘事件向下传递到view层级中。
Used by custom windows, such as Dialog, to pass the key shortcut press event further down the view hierarchy.
|
||||||||||
abstract boolean | superDispatchTouchEvent(MotionEvent event) 派遣触摸事件(鼠标事件) 被自定义的window使用,如dialog。用于将通常的触屏事件向下传递到view层级中。
Used by custom windows, such as Dialog, to pass the touch screen event further down the view hierarchy.
|
||||||||||
abstract boolean | superDispatchTrackballEvent(MotionEvent event) 派遣轨迹事件(鼠标事件) 被自定义的window使用,如dialog,用于将轨迹事件向下传递到view的层级中。
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) 取得键盘事件(是否得到) 请求得到键盘事件到这个activity。
Request that key events come to this activity.
|
||||||||||
abstract void | takeSurface(SurfaceHolder.Callback2 callback) 取得该window的surface的拥有权控制权。(SurfaceHolder.CallBack2接口)
Take ownership of this window's surface.
|
||||||||||
abstract void | togglePanel(int featureId, KeyEvent event) 切换面板(特征Id,键盘事件) |
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
final int | getFeatures()
获取启用的特征
Return the feature bits that are enabled.
|
||||||||||
final int | 获取被客户明确设置的window flag,所以将不会被getDecorView修改。
Return the window flags that have been explicitly set by the client, so will not be modified by
getDecorView() .
|
||||||||||
final int | 获取被这个窗口实现的特征
Return the feature bits that are being implemented by this Window.
|
||||||||||
final boolean | 是否有软输入模式
Has the app specified their own soft input mode?
|
||||||||||
abstract void | onActive()是否激活 | ||||||||||
void | setDefaultWindowFormat(int format) 设置默认的窗口模式(模式)
Set the default format of window, as per the PixelFormat types.
|