public interface
WindowManager
implements ViewManager
android.view.WindowManager |
Class Overview类的概览
The interface that apps use to talk to the window manager.
Use Context.getSystemService(Context.WINDOW_SERVICE)
to
get one of these.
Each window manager instance is bound to a particular Display
.
To obtain a WindowManager
for
a different display, use createDisplayContext(Display)
to
obtain a Context
for
that display, then
use Context.getSystemService(Context.WINDOW_SERVICE)
to
get the WindowManager.
The simplest way to show a window on another display is to create
a Presentation
.
The presentation will automatically obtain a WindowManager
and Context
for
that display.
WindowManager是一个接口,apps使用它和窗口管理器对话。
使用Context.getSystemService(Context.WINDOW_SERVICE)去得到这样的一个接口。
每一个窗口管理器实例绑定到一个特定的DisPlay中。若要为不同的display获得一个WindowManager,先使用createDisplayContext(Display)方法为那个display获得一个Context,然后使用Context.getSystemService(Context.WINDOW_SERVICE)方法获得WindowManager。
在另外一个display上显示一个窗口的最简单的方式是创造一个Pesentation。这个presentation 将会自动为那个display获得一个WindowManager和Context。
See Also
Summary
Nested Classes内部类 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
class |
WindowManager.BadTokenException 异常类 |
Exception that is thrown when trying
to add view whose WindowManager.LayoutParams token is
invalid. 当LayoutParams无效时试图添加一个类,会抛出这个异常。 |
|||||||||
class |
WindowManager.InvalidDisplayException 异常类 |
Exception that is thrown when calling 当调用addView(view,layoutParams)这个方法为第二个display添加view,而这第二个display又找不到时,会抛出这个异常。 |
|||||||||
class |
布局参数类 |
Public Methods公共方法 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
abstract Display |
获得默认的Display.在这个display上,WindowManager的实例将会创建新的windows。 Returns the
Display upon
which this WindowManager instance
will create new windows. |
||||||||||
abstract void |
removeViewImmediate(View view) 立即移除View(View) .立即调用View.onDetachedFromWindow()方法移除View而不是等到returning后才移除。 Special variation of
removeView(View) that
immediately invokes the given view hierarchy‘s View.onDetachedFromWindow() methods
before returning. |
[Expand]
Inherited Methods
| |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From
interface android.view.ViewManager
|
Public Methods
public abstract Display getDefaultDisplay ()
Returns the Display
upon
which this WindowManager
instance
will create new windows.
Despite the name of this method, the display that is returned is not
necessarily the primary display of the system (see DEFAULT_DISPLAY
).
The returned display could instead be a secondary display that this window
manager instance is managing. Think of it as the display that this WindowManager
instance
uses by default.
To create windows on a different display, you need to obtain a WindowManager
for
that Display
.
(See the WindowManager
class
documentation for more information.)
返回一个Display。在这个Display上,这个WindowManager实例将会创建新的窗口。
尽管名字是“获得默认的Display”,然而得到的这个Display没有规定必须是系统的初始display(DEFAULT_DISPLAY)。返回的display可以是这个窗口管理器正在管理的第二的Display。就把这第二个Display想成是该WindowManager实例默认使用的display。
为了在不同的display上创建windows,你需要为那个display获得一个WindowMananger。(请看WindowMananger类文档得到更多的信息)
Returns
- The display that this window manager is managing. 返回这个窗口管理器正在管理的display。
public abstract void removeViewImmediate (View view)
Special variation of removeView(View)
that
immediately invokes the given view hierarchy‘s View.onDetachedFromWindow()
methods
before returning. This is not for normal applications; using it correctly
requires great care.
这个是removeView(view)的一个特殊的变体,让可以让view在returning之前就立即被移除,通过View.onDetachedFromWindow()这个方法来达到。
Parameters
view | The view to be removed. |
---|