Window API译文

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

接口

Window.Callback

回调类

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 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

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.

final Context

getContext()

获取这个正在运行的窗口的上下文信息,从而可以从这些信息中获取到资源和其他的信息。

Return the Context this window policy is running in,
for retrieving resources and other information.

abstract View

getCurrentFocus()

获取当前窗口中当前得到焦点的view。如果没有任何view得到焦点,则返回空。

Return the view in this Window that currently has
focus, or null if there are none.

abstract View

getDecorView()

获得修饰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

getLayoutInflater()

获得LayoutInflater实例。这个实例是从窗口从自己的上下文信息中得到的。

Quick access to the LayoutInflater instance that this Window
retrieved from its Context.

abstract int getVolumeControlStream()获得音量控制流
WindowManager

getWindowManager()

获得这个window的窗口管理器window manager。window manager
允许这个window显示它的windows。

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)无效的面板菜单(特征 id)

final boolean isActive()是否激活
abstract boolean

isFloating()

是否是悬浮状态

Return whether this window is being displayed with a
floating style (based on the windowIsFloatingattribute
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

peekDecorView()

获得当前窗口的修饰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的标记。

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)

设置Logo(资源)

Set the logo for this window.

void

setSoftInputMode(int
mode)

设置软输入模式(模式)

Specify an explicit soft input mode to use for the
window, as perWindowManager.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

getForcedWindowFlags()

获取被客户明确设置的window flag,因此将不会被getDecorView修改。

Return the window flags that have been explicitly set
by the client, so will not be modified by getDecorView().

final int

getLocalFeatures()

获取被这个窗口实现的特征

Return the feature bits that are being implemented by
this Window.

final boolean

hasSoftInputMode()

是否有软输入模式

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.

时间: 2024-10-07 20:09:21

Window API译文的相关文章

【最后一篇API译文】Android开发-API指南- Contacts Provider

Contacts Provider 今年加入了某字幕组,加之杂事颇多,许久未添新文了,惭愧之极. 在听闻 Google 即将重返中国后,近日忽又发现官方网站正在放出 API 中文版,比如本文.当然不是大家所译,但至少句子结构较通顺,窃以为比 MSDN 中文版好些.虽有些生硬(比如将 Provider 译为“提供者”,有趣得紧),但好在前无古人,也许 Google 自此便统一了自己的中文术语也未可知.能让更多的国人精确领悟 Android 的精髓,肯定是好事,希望 Google 继续坚持. 这事应

C#使用window API 控制打印纸张大小(转载)

windows一个特点就是设备无关性,这样就给程序控制打印机提供了很好的方法. 首先引用“泥人张”写的打印API类. using System;using System.Collections;using System.Text;using System.Runtime.InteropServices;using System.Security;using System.ComponentModel;using System.Drawing.Printing;namespace PrintAPI

Window API串口编程

虽然使用诸如 CSerialPort VC串口类,MSComm VC 串口控件等非常方便,但有时这些控件并不适合自己的特殊需求,所以有必要了解一下基于Windows API的串口编程方法,下面介绍一下API串口编程的一般步骤及相关串口API函数. 串口操作一般有四步,分别是: 1) 打开串口 2) 配置串口 3) 读写串口 4) 关闭串口 1. 打开串口 在<VC 打开串口>一文中我们已经单独介绍过如果利用API打开串口的方法,打开串口是用API函数CreateFile来打开或创建的.该函数的

C#:通过Window API接口实现WiFi

1.获取Mac地址 //WiFi通知回调 private WlanApi.WLAN_NOTIFICATION_CALLBACK _notificationCallback; this._notificationCallback = new WlanApi.WLAN_NOTIFICATION_CALLBACK(this.OnNotification); WLAN_NOTIFICATION_SOURCE notifSource; WiFiApiUtils.Throw_On_Win32_Error(W

[php代码审计] Window api函数 FindFirstFile 在php中的问题

include文件夹中文件: 内容: <?php echo __FILE__; ?> index.php: 演示如下: "<<"替换多个任意字符: ">"替换单个字符:

c# 调用 WINDOW API DLL

using System.Runtime.InteropServices; [DllImport("user32.dll", CallingConvention = CallingConvention.StdCall)] public static extern int MessageBox(int hWnd, String strMessage, String strCaption, uint uiType); //调用 MessageBox(0, "您好,这是 PInvo

HTML 5 History API的”前生今世”

原文:An Introduction To The HTML5 History API 译文:关于HTML 5 History API 的介绍 译者:dwqs History是有趣的,不是吗?在之前的HTML版本中,我们对浏览历史记录的操作非常有限.我们可以来回使用可以使用的方法,但这就是一切我们能做的了. 但是,利用HTML 5的History API,我们可以更好的控制浏览器的历史记录了.例如:我们可以添加一条记录到历史记录的列表中,或者在没有刷新时,可以更新地址栏的URL. 为什么介绍Hi

HTML 5 History API

原文:An Introduction To The HTML5 History API 译文:关于HTML 5 History API 的介绍 译者:dwqs History是有趣的,不是吗?在之前的HTML版本中,我们对浏览历史记录的操作非常有限.我们可以来回使用可以使用的方法,但这就是一切我们能做的了. 但是,利用HTML 5的History API,我们可以更好的控制浏览器的历史记录了.例如:我们可以添加一条记录到历史记录的列表中,或者在没有刷新时,可以更新地址栏的URL. 为什么介绍Hi

英文不好也能快速&quot;记忆&quot; API

英文不好不要紧,把API函数导入打字练习类软件,即是练习打字速度,提高编程效率:也能短时间记忆API. 坚持每天打一遍,约2小时,连续打两周,会对API有很好的记忆,此方法是结合英文学习方法!以下是Window API函数例表,大家可以试试效果特别好! AbnormalTermination AbortDoc AbortPath AbortPrinter AbortProc AbortSystemShutdown AccessNtmsLibraryDoor ActivateKeyboardLay