public class Display extends Object
An Display object is returned by
DisplayManager.getDefaultDisplay(Context).
| 限定符和类型 | 字段 | 说明 |
|---|---|---|
static int |
STATE_DOZE |
Indicate that this screen is dozing.
|
static int |
STATE_DOZE_SUSPEND |
Indicate that this screen is dozing, but the CPU suspends updating it.
|
static int |
STATE_OFF |
Indicate that this screen is off.
|
static int |
STATE_ON |
Indicate that this screen is on.
|
static int |
STATE_ON_SUSPEND |
Indicate that this screen is on, but the CPU suspends updating it.
|
static int |
STATE_UNKNOWN |
Indicate that this screen is in an unknown state.
|
static int |
STATE_VR |
Indicate that this screen is in a virtual reality (VR) state.
|
| 构造器 | 说明 |
|---|---|
Display() |
A constructor used to create a
Display instance. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
DisplayAttributes |
getAttributes() |
Obtain the Attributes of a display.
|
void |
getCurrentSizeRange(Point outSmallestSize,
Point outLargestSize) |
Obtain the size range of a display, in unit of pixels.
|
int |
getDisplayId() |
Obtain the ID of a display.
|
String |
getDisplayName() |
Obtain the name of a display.
|
int |
getDisplayState() |
Obtain the state of this display device.
|
DisplayAttributes |
getRealAttributes() |
Obtain the actual Attributes of a display.
|
void |
getRealSize(Point outSize) |
Obtain the actual display size.
|
float |
getRefreshRate() |
Obtain the screen refresh rate per second of this display device.
|
int |
getRotation() |
Obtain the rotation degree of a display.
|
void |
getSize(Point outSize) |
Obtain the size of a display.
|
boolean |
isAlive() |
Check whether this display device is alive.
|
public static final int STATE_DOZE
public static final int STATE_DOZE_SUSPEND
public static final int STATE_OFF
public static final int STATE_ON
public static final int STATE_ON_SUSPEND
public static final int STATE_UNKNOWN
public static final int STATE_VR
public int getDisplayId()
NullPointerException - Throws this exception if mDisplayWrapper is null.public String getDisplayName()
NullPointerException - Throws this exception if mDisplayWrapper is null.public int getRotation()
0 indicates no rotation, 1 indicates 90 degrees, 2 indicates 180 degrees, and 3
indicates 270 degrees.NullPointerException - Throws this exception if mDisplayWrapper is null.public DisplayAttributes getAttributes()
NullPointerException - Throws this exception if mDisplayWrapper is null.public DisplayAttributes getRealAttributes()
NullPointerException - Throws this exception if mDisplayWrapper is null.public void getCurrentSizeRange(Point outSmallestSize, Point outLargestSize)
This method obtains the maximum and minimum sizes of the display expected in all directions. The obtained display range is stored in the parameters of this method.
outSmallestSize - Indicate the minimum display size.outLargestSize - Indicate the maximum display size.NullPointerException - Throws this exception if mDisplayWrapper is null.public void getSize(Point outSize)
This method may not return the actual size of the display. For example, the returned value has excluded the size of the status bar if status bar is always displayed, or the value matches a display that has been scaled for adapting to a small-screen device.
outSize - Indicate the display size.NullPointerException - Throws this exception if mDisplayWrapper is null.public void getRealSize(Point outSize)
The returned value includes the size of the status bar, without any scale.
outSize - Indicate the actual size of the display.NullPointerException - Throws this exception if mDisplayWrapper is null.public float getRefreshRate()
NullPointerException - Throws this exception if mDisplayWrapper is null.public int getDisplayState()
STATE_OFF, STATE_ON,
STATE_DOZE, STATE_DOZE_SUSPEND, STATE_ON_SUSPEND, or STATE_UNKNOWN.NullPointerException - Throws this exception if mDisplayWrapper is null.public boolean isAlive()
true if this display device is alive; returns false
if this display device is removed.NullPointerException - Throws this exception if mDisplayWrapper is null.