public abstract class
Window
extends Object
java.lang.Object | |
? | android.view.Window |
Class
Overview
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
window是一个抽象基类,负责顶层窗口显示和行为的规则。这个类的一个实例必须被用作顶层的view加入到window
manager中。它提供了标准UI规则,例如:背景,标题区域,默认的主进程等等。
这个抽象类的仅有的一个实现是android.policy.PhoneWindow。当你需要一个窗口window的时候,你需要实例化PhoneWindow。最后,PhoneWindow这个类会使用你不需要知道的特殊实现方式的重构方法进行重构,从而得到一个PhoneWindow对象,也即得到一个窗口。
Summary
Nested Classes内部类 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
interface 接口 |
回调类 |
API from a Window back to its caller. 应用程序编程接口:从窗口window到它的调用者 |
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 | ||||||||||
void |
addFlags(int 为window添加特定的特征。 Convenience function to set the flag bits as specified | ||||||||||
void |
clearFlags(int 清除window的某一特征 Convenience function to clear the flag bits as | ||||||||||
abstract void | closeAllPanels()关闭所有嵌入的面板 | ||||||||||
abstract void | closePanel(int featureId)关闭某一个指定的嵌入面板 | ||||||||||
View |
findViewById(int 通过id获取view。通过onCreate方法中处理的xml文件中标识View的 id,获取view。 Finds a view that was identified by the id attribute | ||||||||||
final WindowManager.LayoutParams |
获取当前窗口与这个面板相关的属性(布局信息)。 Retrieve the current window attributes associated with | ||||||||||
final Window.Callback |
获取这个窗口的回调接口。 Return the current Callback interface for this | ||||||||||
final Window |
获取这个窗口的容器(还是一个窗口) Return the container for this Window. | ||||||||||
final Context |
获取这个正在运行的窗口的上下文信息,从而可以从这些信息中获取到资源和其他的信息。 Return the Context this window policy is running in, | ||||||||||
abstract View |
获取当前窗口中当前得到焦点的view。如果没有任何view得到焦点,则返回空。 Return the view in this Window that currently has | ||||||||||
abstract View |
获得修饰view。获得顶层窗口的修饰view(包括标准窗口框架结构,修饰和窗口中的内容)。这个修饰view可以被当作一个window加入到window Retrieve the top-level window decor view (containing | ||||||||||
abstract LayoutInflater |
获得LayoutInflater实例。这个实例是从窗口从自己的上下文信息中得到的。 Quick access to the | ||||||||||
abstract int | getVolumeControlStream()获得音量控制流 | ||||||||||
WindowManager |
获得这个window的窗口管理器window manager。window manager Return the window manager allowing this Window to | ||||||||||
final TypedArray |
获得窗口主题的窗口属性。 Return the | ||||||||||
final boolean | hasChildren()有子孩子 | ||||||||||
boolean |
hasFeature(int 查询是否有某一个特定的特征 Query for the availability of a certain feature. | ||||||||||
void |
injectInputEvent(InputEvent event) 为窗口注册一个本地输入事件 Inject an event to window locally. | ||||||||||
abstract void |
invalidatePanelMenu(int | ||||||||||
final boolean | isActive()是否激活 | ||||||||||
abstract boolean |
是否是悬浮状态 Return whether this window is being displayed with a | ||||||||||
abstract boolean |
isShortcutKey(int 是否是这个窗口的快捷键(键码,键盘事件) Is a keypress one of the defined shortcut keys for | ||||||||||
final void | makeActive()让这个窗口处于激活状态 | ||||||||||
abstract void |
onConfigurationChanged(Configuration newConfig) 但窗口的配置信息改变时(新的配置信息) Should be called when the configuration is | ||||||||||
abstract void | openPanel(int featureId, KeyEvent event)打开面板(特征Id,键盘事件) | ||||||||||
abstract View |
获得当前窗口的修饰view:decor view.前提是这个修饰view已经被创建,否则会返回空 Retrieve the current decor view, but only if it has | ||||||||||
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 请求某一扩展的屏幕特征有效(特征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 | ||||||||||
void |
setBackgroundDrawableResource(int 设置窗口背景图像资源(资源Id) Change the background of this window to a Drawable | ||||||||||
void |
setCallback(Window.Callback callback) 设置这个窗口的回调接口,用于中断按键事件和其他窗口中的动态操作 Set the Callback interface for this window, used to | ||||||||||
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 | ||||||||||
abstract void |
setContentView(int 设置内容view(资源) Convenience for | ||||||||||
abstract void |
setContentView(View view, ViewGroup.LayoutParams params) 设置内容view(view,LayoutParams) Set the screen content to an explicit view. | ||||||||||
void |
setDimAmount(float 设置窗口背后的模糊度 Set the amount of dim behind the window when | ||||||||||
abstract void | setFeatureDrawable(int featureId, Drawable drawable) 设置特征图片(特征Id,图片) Set an explicit Drawable value for feature of this | ||||||||||
abstract void | setFeatureDrawableAlpha(int featureId, int alpha) 设置特征图片透明度(特征Id,透明度) Set a custom alpha value for the given drawale | ||||||||||
abstract void |
setFeatureDrawableResource(int 设置特征图片资源(特征id,资源) Set the value for a drawable feature of this window, | ||||||||||
abstract void |
setFeatureDrawableUri(int 设置特征图片Uril(特征Id,uri) Set the value for a drawable feature of this window, | ||||||||||
abstract void |
setFeatureInt(int 设置特征(特征Id,值) Set the integer value for a feature. | ||||||||||
void |
setFlags(int 设置window的标记,作为一个WindowManager.LayoutParams的标记。 Set the flags of the window, as per the | ||||||||||
void |
setFormat(int 设置格式(像素格式) Set the format of window, as per the PixelFormat | ||||||||||
void |
setGravity(int 设置权重(权重) Set the gravity of the window, as per the Gravity | ||||||||||
void |
setIcon(int 为窗口设置设置图标(资源) Set the primary icon for this window. | ||||||||||
void |
setLayout(int 设置布局(宽度,高度) Set the width and height layout parameters of the | ||||||||||
void |
setLocalFocus(boolean 设置本地焦点(是否具有焦点,是否是触屏模式) Set focus locally. | ||||||||||
void |
setLogo(int 设置Logo(资源) Set the logo for this window. | ||||||||||
void |
setSoftInputMode(int 设置软输入模式(模式) Specify an explicit soft input mode to use for the | ||||||||||
abstract void |
setTitle(CharSequence title)设置标题(标题) | ||||||||||
abstract void | setTitleColor(int textColor)设置标题颜色(颜色) | ||||||||||
void |
setType(int 设置窗口类型(类型),正如每个窗口布局的类型 Set the type of the window, as per the WindowManager.LayoutParams | ||||||||||
void |
setUiOptions(int 设置额外的UI操作(UI操作) Set extra options that will influence the UI for this | ||||||||||
void |
setUiOptions(int 设置额外的UI操作选项(操作,动作掩码) Set extra options that will influence the UI for this | ||||||||||
abstract void | setVolumeControlStream(int streamType)设置音量控制流(流类型) | ||||||||||
void |
setWindowAnimations(int 设置窗口动画(动画资源) Specify custom animations to use for the window, as | ||||||||||
void |
setWindowManager(WindowManager wm, IBinder appToken, String appName, boolean 设置窗口所用的窗口管理器,如用来显示plane。 Set the window manager for use by this Window to, for | ||||||||||
void |
setWindowManager(WindowManager wm, IBinder appToken, String appName) 设置窗口所用的窗口管理器,如用来显示plane。 Set the window manager for use by this Window to, for | ||||||||||
abstract boolean |
superDispatchGenericMotionEvent(MotionEvent event) 派遣鼠标事件(鼠标事件) 被自定义的window使用,如diaglog。用于将一般的鼠标事件向下传递到view层级中。 Used by custom windows, such as Dialog, to pass the | ||||||||||
abstract boolean |
superDispatchKeyEvent(KeyEvent event) 派遣键盘事件(键盘事件) 被自定义的window使用,如diaglog。用于将一般的按键事件向下传递到view层级中。 Used by custom windows, such as Dialog, to pass the | ||||||||||
abstract boolean |
superDispatchKeyShortcutEvent(KeyEvent event) 派遣快捷键事件(键盘事件) 被自定义的window使用,如dialog。用于将一般的键盘事件向下传递到view层级中。 Used by custom windows, such as Dialog, to pass the | ||||||||||
abstract boolean |
superDispatchTouchEvent(MotionEvent event) 派遣触摸事件(鼠标事件) 被自定义的window使用,如dialog。用于将一般的触屏事件向下传递到view层级中。 Used by custom windows, such as Dialog, to pass the | ||||||||||
abstract boolean |
superDispatchTrackballEvent(MotionEvent event) 派遣轨迹事件(鼠标事件) 被自定义的window使用,如dialog,用于将轨迹事件向下传递到view的层级中。 Used by custom windows, such as Dialog, to pass the | ||||||||||
abstract void |
takeInputQueue(InputQueue.Callback callback) 取得输入的队列(输入回调接口) 获得输入队列的所有权 Take ownership of this window‘s InputQueue. | ||||||||||
abstract void |
takeKeyEvents(boolean 取得键盘事件(是否获得) 请求获得键盘事件到这个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 | ||||||||||
final int |
获取被这个窗口实现的特征 Return the feature bits that are being implemented by | ||||||||||
final boolean |
是否有软输入模式 Has the app specified their own soft input mode? | ||||||||||
abstract void | onActive()是否激活 | ||||||||||
void |
setDefaultWindowFormat(int 设置默认的窗口模式(模式) Set the default format of window, as per the |