TypedValue.DeriveDimension(ComplexUnitType, Single, DisplayMetrics) Method

Definition

Converts a pixel value to the given dimension, e.

[Android.Runtime.Register("deriveDimension", "(IFLandroid/util/DisplayMetrics;)F", "", ApiSince=34)]
public static float DeriveDimension (Android.Util.ComplexUnitType unitToConvertTo, float pixelValue, Android.Util.DisplayMetrics metrics);
[<Android.Runtime.Register("deriveDimension", "(IFLandroid/util/DisplayMetrics;)F", "", ApiSince=34)>]
static member DeriveDimension : Android.Util.ComplexUnitType * single * Android.Util.DisplayMetrics -> single

Parameters

unitToConvertTo
ComplexUnitType

The unit to convert to.

pixelValue
Single

The raw pixels value to convert from.

metrics
DisplayMetrics

Current display metrics to use in the conversion -- supplies display density and scaling information.

Returns

A dimension value equivalent to the given number of pixels

Attributes

Remarks

Converts a pixel value to the given dimension, e.g. PX to DP.

This is the inverse of #applyDimension(int, float, DisplayMetrics)

Java documentation for android.util.TypedValue.deriveDimension(int, float, android.util.DisplayMetrics).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to