public class

Display

extends Object
java.lang.Object
   ↳ android.view.Display

Summary

Constants
int DEFAULT_DISPLAY Specify the default Display
Public Methods
int getDisplayId()
Returns the index of this display.
int getHeight()
Returns the raw height of the display, in pixels.
void getMetrics(DisplayMetrics outMetrics)
Initialize a DisplayMetrics object from this display's data.
int getOrientation()
This method is deprecated. use getRotation()
int getPixelFormat()
Return the native pixel format of the display.
float getRefreshRate()
Return the refresh rate of this display in frames per second.
int getRotation()
Returns the rotation of the screen from its "natural" orientation.
int getWidth()
Returns the raw width of the display, in pixels.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int DEFAULT_DISPLAY

Since: API Level 1

Specify the default Display

Constant Value: 0 (0x00000000)

Public Methods

public int getDisplayId ()

Since: API Level 1

Returns the index of this display. This is currently undefined; do not use.

public int getHeight ()

Since: API Level 1

Returns the raw height of the display, in pixels. Note that this should not generally be used for computing layouts, since a device will typically have screen decoration (such as a status bar) along the edges of the display that reduce the amount of application space available from the raw size returned here. This value is adjusted for you based on the current rotation of the display.

public void getMetrics (DisplayMetrics outMetrics)

Since: API Level 1

Initialize a DisplayMetrics object from this display's data.

public int getOrientation ()

Since: API Level 1

This method is deprecated.
use getRotation()

Returns
  • orientation of this display.

public int getPixelFormat ()

Since: API Level 1

Return the native pixel format of the display. The returned value may be one of the constants int PixelFormat.

public float getRefreshRate ()

Since: API Level 1

Return the refresh rate of this display in frames per second.

public int getRotation ()

Since: API Level 8

Returns the rotation of the screen from its "natural" orientation. The returned value may be Surface.ROTATION_0 (no rotation), Surface.ROTATION_90, Surface.ROTATION_180, or Surface.ROTATION_270. For example, if a device has a naturally tall screen, and the user has turned it on its side to go into a landscape orientation, the value returned here may be either Surface.ROTATION_90 or Surface.ROTATION_270 depending on the direction it was turned. The angle is the rotation of the drawn graphics on the screen, which is the opposite direction of the physical rotation of the device. For example, if the device is rotated 90 degrees counter-clockwise, to compensate rendering will be rotated by 90 degrees clockwise and thus the returned value here will be Surface.ROTATION_90.

public int getWidth ()

Since: API Level 1

Returns the raw width of the display, in pixels. Note that this should not generally be used for computing layouts, since a device will typically have screen decoration (such as a status bar) along the edges of the display that reduce the amount of application space available from the raw size returned here. This value is adjusted for you based on the current rotation of the display.