Android Guides | Samples

Android.Util.DisplayMetrics Class

A structure describing general information about a display, such as its size, density, and font scaling.

See Also: DisplayMetrics

Syntax

[Android.Runtime.Register("android/util/DisplayMetrics", DoNotGenerateAcw=true)]
public class DisplayMetrics : Object

Remarks

A structure describing general information about a display, such as its size, density, and font scaling.

java Example

 DisplayMetrics metrics = new DisplayMetrics();
 getWindowManager().getDefaultDisplay().getMetrics(metrics);

To access the DisplayMetrics members, initialize an object like this:

[Android Documentation]

Requirements

Namespace: Android.Util
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1

The members of Android.Util.DisplayMetrics are listed below.

See Also: Object

Public Constructors

Protected Constructors

A constructor used when creating managed representations of JNI objects; called by the runtime.

Public Fields

const
Density400DisplayMetricsDensity (400). Intermediate density for screens that sit somewhere between DisplayMetrics.DensityXhigh (320 dpi) and DisplayMetrics.DensityXxhigh (480 dpi).
const
Density560DisplayMetricsDensity (560). Intermediate density for screens that sit somewhere between DisplayMetrics.DensityXxhigh (480 dpi) and DisplayMetrics.DensityXxxhigh (640 dpi).
const
DensityDefaultDisplayMetricsDensity (160). The reference density used throughout the system.
const
DensityHighDisplayMetricsDensity (240). Standard quantized DPI for high-density screens.
const
DensityLowDisplayMetricsDensity (120). Standard quantized DPI for low-density screens.
const
DensityMediumDisplayMetricsDensity (160). Standard quantized DPI for medium-density screens.
const
DensityTvDisplayMetricsDensity (213). This is a secondary density, added for some common screen configurations.
const
DensityXhighDisplayMetricsDensity (320). Standard quantized DPI for extra-high-density screens.
const
DensityXxhighDisplayMetricsDensity (480). Standard quantized DPI for extra-extra-high-density screens.
const
DensityXxxhighDisplayMetricsDensity (640). Standard quantized DPI for extra-extra-extra-high-density screens.

Public Properties

DensitySingle. The logical density of the display.
DensityDpiDisplayMetricsDensity. The screen density expressed as dots-per-inch.
HeightPixelsInt32. The absolute height of the display in pixels.
ScaledDensitySingle. A scaling factor for fonts displayed on the display.
WidthPixelsInt32. The absolute width of the display in pixels.
XdpiSingle. The exact physical pixels per inch of the screen in the X dimension.
YdpiSingle. The exact physical pixels per inch of the screen in the Y dimension.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

Equals(DisplayMetrics) : Boolean
Returns true if these display metrics equal the other display metrics.
SetTo(DisplayMetrics)
SetToDefaults()