public final class VirtualDisplay
extends Object
| java.lang.Object | |
| android.hardware.display.VirtualDisplay | |
代表虚拟显示。 虚拟显示的内容渲染到Surface ,你必须提供createVirtualDisplay() 。
由于虚拟显示器呈现到应用程序提供的表面,因此当进程终止并且其上的所有剩余窗口将被强制删除时,它将自动释放。 但是,当你完成它时,你也应该明确地调用release() 。
Nested classes |
|
|---|---|
class |
VirtualDisplay.Callback 用于接收有关 |
公共方法(Public methods) |
|
|---|---|
Display |
getDisplay() 获取虚拟显示。 |
Surface |
getSurface() 获取支持虚拟显示的表面。 |
void |
release() 释放虚拟显示并破坏其底层表面。 |
void |
resize(int width, int height, int densityDpi) 要求虚拟显示器调整大小。 |
void |
setSurface(Surface surface) 设置支持虚拟显示的表面。 |
String |
toString() 返回对象的字符串表示形式。 |
继承方法(Inherited methods) |
|
|---|---|
java.lang.Object
|
|
void resize (int width,
int height,
int densityDpi)
要求虚拟显示器调整大小。
这实际上只是一种方便,它允许使用虚拟显示的应用程序适应不断变化的条件,而无需拆卸和重新创建显示。
| 参数(Parameters) | |
|---|---|
width |
int
|
height |
int
|
densityDpi |
int
|
void setSurface (Surface surface)
设置支持虚拟显示的表面。
分离支持虚拟显示器的表面具有与关闭屏幕类似的效果。
拆除表面后,表面仍然是主叫方的责任。
| 参数(Parameters) | |
|---|---|
surface |
Surface: The surface to set, or null to detach the surface from the virtual display. |
String toString ()
返回对象的字符串表示形式。 通常, toString方法会返回一个“文本表示”该对象的字符串。 结果应该是一个简洁但内容丰富的表述,对于一个人来说很容易阅读。 建议所有子类重写此方法。
类Object的toString方法返回一个字符串,其中包含对象为实例的类的名称,符号字符“ @ ”以及对象的哈希代码的无符号十六进制表示形式。 换句话说,这个方法返回一个字符串,其值等于:
getClass().getName() + '@' + Integer.toHexString(hashCode())
| 返回(Returns) | |
|---|---|
String |
a string representation of the object. |