Share via


TypedValue.ConvertDimensionToPixels Method

Definition

Converts a dimension value to raw pixels, e.

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

Parameters

unitToConvertFrom
ComplexUnitType

The unit to convert from.

value
Single

The dimension value to apply the unit to.

metrics
DisplayMetrics

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

Returns

The equivalent pixel value—i.e. the complex floating point value multiplied by the appropriate metrics depending on its unit—or zero if unit is not valid.

Attributes

Remarks

Converts a dimension value to raw pixels, e.g. DP to PX.

This is just an alias of #applyDimension(int, float, DisplayMetrics) with an easier-to-find name.

Java documentation for android.util.TypedValue.convertDimensionToPixels(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