Package icyllis.modernui.util
Class DisplayMetrics
java.lang.Object
icyllis.modernui.util.DisplayMetrics
A structure describing general information about a display, such as its
size, density, and font scaling.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfloatThe logical density of the display.
This is a scaling factor for the Density-independent Pixel unit, where one DP is one pixel on an approximately 96 dpi screen, providing the baseline of the system's display.static final intIntermediate density for screens that sit betweenDENSITY_MEDIUM(96dpi) andDENSITY_HIGH(144dpi).static final intIntermediate density for screens that sit betweenDENSITY_MEDIUM(96dpi) andDENSITY_HIGH(144dpi).static final intIntermediate density for screens that sit betweenDENSITY_MEDIUM(96dpi) andDENSITY_HIGH(144dpi).static final intIntermediate density for screens that sit betweenDENSITY_HIGH(144dpi) andDENSITY_XHIGH(192dpi).static final intIntermediate density for screens that sit betweenDENSITY_HIGH(144dpi) andDENSITY_XHIGH(192dpi).static final intIntermediate density for screens that sit betweenDENSITY_HIGH(144dpi) andDENSITY_XHIGH(192dpi).static final intIntermediate density for screens that sit somewhere betweenDENSITY_XHIGH(192 dpi) andDENSITY_XXHIGH(288 dpi).static final intIntermediate density for screens that sit somewhere betweenDENSITY_XHIGH(192 dpi) andDENSITY_XXHIGH(288 dpi).static final intIntermediate density for screens that sit somewhere betweenDENSITY_XHIGH(192 dpi) andDENSITY_XXHIGH(288 dpi).static final intIntermediate density for screens that sit somewhere betweenDENSITY_XHIGH(192 dpi) andDENSITY_XXHIGH(288 dpi).static final intIntermediate density for screens that sit somewhere betweenDENSITY_XHIGH(192 dpi) andDENSITY_XXHIGH(288 dpi).static final intIntermediate density for screens that sit somewhere betweenDENSITY_XHIGH(192 dpi) andDENSITY_XXHIGH(288 dpi).static final intIntermediate density for screens that sit somewhere betweenDENSITY_XHIGH(192 dpi) andDENSITY_XXHIGH(288 dpi).static final intIntermediate density for screens that sit somewhere betweenDENSITY_XXHIGH(288 dpi) andDENSITY_XXXHIGH(384 dpi).static final intIntermediate density for screens that sit somewhere betweenDENSITY_XXHIGH(288 dpi) andDENSITY_XXXHIGH(384 dpi).static final intIntermediate density for screens that sit somewhere betweenDENSITY_XXHIGH(288 dpi) andDENSITY_XXXHIGH(384 dpi).static final intIntermediate density for screens that sit betweenDENSITY_LOW(72dpi) andDENSITY_MEDIUM(96dpi).static final intThe reference density used throughout the system.static final intStandard quantized DPI for high-density screens.static final intStandard quantized DPI for low-density screens.static final intStandard quantized DPI for medium-density screens.static final intStandard quantized DPI for extra-high-density screens.static final intStandard quantized DPI for extra-extra-high-density screens.static final intStandard quantized DPI for extra-extra-extra-high-density screens.intThe screen density expressed as dots-per-inch.intThe absolute height of the available display size in pixels.intThe absolute width of the available display size in pixels.floatThe exact physical pixels per inch of the screen in the X dimension.floatThe exact physical pixels per inch of the screen in the Y dimension. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanequals(DisplayMetrics other) Returns true if these display metrics equal the other display metrics.booleaninthashCode()voidvoidtoString()
-
Field Details
-
DENSITY_LOW
public static final int DENSITY_LOWStandard quantized DPI for low-density screens.- See Also:
-
DENSITY_84
public static final int DENSITY_84Intermediate density for screens that sit betweenDENSITY_LOW(72dpi) andDENSITY_MEDIUM(96dpi). This is not a density that applications should target, instead relying on the system to scale theirDENSITY_MEDIUMassets for them.- See Also:
-
DENSITY_MEDIUM
public static final int DENSITY_MEDIUMStandard quantized DPI for medium-density screens.- See Also:
-
DENSITY_108
public static final int DENSITY_108Intermediate density for screens that sit betweenDENSITY_MEDIUM(96dpi) andDENSITY_HIGH(144dpi). This is not a density that applications should target, instead relying on the system to scale theirDENSITY_HIGHassets for them.- See Also:
-
DENSITY_120
public static final int DENSITY_120Intermediate density for screens that sit betweenDENSITY_MEDIUM(96dpi) andDENSITY_HIGH(144dpi). This is not a density that applications should target, instead relying on the system to scale theirDENSITY_HIGHassets for them.- See Also:
-
DENSITY_132
public static final int DENSITY_132Intermediate density for screens that sit betweenDENSITY_MEDIUM(96dpi) andDENSITY_HIGH(144dpi). This is not a density that applications should target, instead relying on the system to scale theirDENSITY_HIGHassets for them.- See Also:
-
DENSITY_HIGH
public static final int DENSITY_HIGHStandard quantized DPI for high-density screens.- See Also:
-
DENSITY_156
public static final int DENSITY_156Intermediate density for screens that sit betweenDENSITY_HIGH(144dpi) andDENSITY_XHIGH(192dpi). This is not a density that applications should target, instead relying on the system to scale theirDENSITY_XHIGHassets for them.- See Also:
-
DENSITY_168
public static final int DENSITY_168Intermediate density for screens that sit betweenDENSITY_HIGH(144dpi) andDENSITY_XHIGH(192dpi). This is not a density that applications should target, instead relying on the system to scale theirDENSITY_XHIGHassets for them.- See Also:
-
DENSITY_180
public static final int DENSITY_180Intermediate density for screens that sit betweenDENSITY_HIGH(144dpi) andDENSITY_XHIGH(192dpi). This is not a density that applications should target, instead relying on the system to scale theirDENSITY_XHIGHassets for them.- See Also:
-
DENSITY_XHIGH
public static final int DENSITY_XHIGHStandard quantized DPI for extra-high-density screens.- See Also:
-
DENSITY_204
public static final int DENSITY_204Intermediate density for screens that sit somewhere betweenDENSITY_XHIGH(192 dpi) andDENSITY_XXHIGH(288 dpi). This is not a density that applications should target, instead relying on the system to scale theirDENSITY_XXHIGHassets for them.- See Also:
-
DENSITY_216
public static final int DENSITY_216Intermediate density for screens that sit somewhere betweenDENSITY_XHIGH(192 dpi) andDENSITY_XXHIGH(288 dpi). This is not a density that applications should target, instead relying on the system to scale theirDENSITY_XXHIGHassets for them.- See Also:
-
DENSITY_234
public static final int DENSITY_234Intermediate density for screens that sit somewhere betweenDENSITY_XHIGH(192 dpi) andDENSITY_XXHIGH(288 dpi). This is not a density that applications should target, instead relying on the system to scale theirDENSITY_XXHIGHassets for them.- See Also:
-
DENSITY_240
public static final int DENSITY_240Intermediate density for screens that sit somewhere betweenDENSITY_XHIGH(192 dpi) andDENSITY_XXHIGH(288 dpi). This is not a density that applications should target, instead relying on the system to scale theirDENSITY_XXHIGHassets for them.- See Also:
-
DENSITY_252
public static final int DENSITY_252Intermediate density for screens that sit somewhere betweenDENSITY_XHIGH(192 dpi) andDENSITY_XXHIGH(288 dpi). This is not a density that applications should target, instead relying on the system to scale theirDENSITY_XXHIGHassets for them.- See Also:
-
DENSITY_264
public static final int DENSITY_264Intermediate density for screens that sit somewhere betweenDENSITY_XHIGH(192 dpi) andDENSITY_XXHIGH(288 dpi). This is not a density that applications should target, instead relying on the system to scale theirDENSITY_XXHIGHassets for them.- See Also:
-
DENSITY_270
public static final int DENSITY_270Intermediate density for screens that sit somewhere betweenDENSITY_XHIGH(192 dpi) andDENSITY_XXHIGH(288 dpi). This is not a density that applications should target, instead relying on the system to scale theirDENSITY_XXHIGHassets for them.- See Also:
-
DENSITY_XXHIGH
public static final int DENSITY_XXHIGHStandard quantized DPI for extra-extra-high-density screens.- See Also:
-
DENSITY_312
public static final int DENSITY_312Intermediate density for screens that sit somewhere betweenDENSITY_XXHIGH(288 dpi) andDENSITY_XXXHIGH(384 dpi). This is not a density that applications should target, instead relying on the system to scale theirDENSITY_XXXHIGHassets for them.- See Also:
-
DENSITY_336
public static final int DENSITY_336Intermediate density for screens that sit somewhere betweenDENSITY_XXHIGH(288 dpi) andDENSITY_XXXHIGH(384 dpi). This is not a density that applications should target, instead relying on the system to scale theirDENSITY_XXXHIGHassets for them.- See Also:
-
DENSITY_360
public static final int DENSITY_360Intermediate density for screens that sit somewhere betweenDENSITY_XXHIGH(288 dpi) andDENSITY_XXXHIGH(384 dpi). This is not a density that applications should target, instead relying on the system to scale theirDENSITY_XXXHIGHassets for them.- See Also:
-
DENSITY_XXXHIGH
public static final int DENSITY_XXXHIGHStandard quantized DPI for extra-extra-extra-high-density screens. Applications should not generally worry about this density; relying on XHIGH graphics being scaled up to it should be sufficient for almost all cases.- See Also:
-
DENSITY_DEFAULT
public static final int DENSITY_DEFAULTThe reference density used throughout the system.- See Also:
-
widthPixels
public int widthPixelsThe absolute width of the available display size in pixels. -
heightPixels
public int heightPixelsThe absolute height of the available display size in pixels. -
density
public float densityThe logical density of the display.
This is a scaling factor for the Density-independent Pixel unit, where one DP is one pixel on an approximately 96 dpi screen, providing the baseline of the system's display. Thus on a 96 dpi screen this density value will be 1; on a 72 dpi screen it would be .75; etc.This value does not exactly follow the real screen size (as given by
xdpiandydpi), but rather is used to scale the size of the overall UI in steps based on gross changes in the display dpi.- See Also:
-
densityDpi
public int densityDpiThe screen density expressed as dots-per-inch. May be any one of theDENSITY_constants defined above. -
xdpi
public float xdpiThe exact physical pixels per inch of the screen in the X dimension. -
ydpi
public float ydpiThe exact physical pixels per inch of the screen in the Y dimension.
-
-
Constructor Details
-
DisplayMetrics
public DisplayMetrics()
-
-
Method Details
-
setTo
-
setToDefaults
public void setToDefaults() -
equals
-
equals
Returns true if these display metrics equal the other display metrics.- Parameters:
other- The display metrics with which to compare.- Returns:
- True if the display metrics are equal.
-
hashCode
public int hashCode() -
toString
-