Share via


TypedValue.ConvertPixelsToDimension Method

Definition

Converts a pixel value to the given dimension, e.

[Android.Runtime.Register("convertPixelsToDimension", "(IFLandroid/util/DisplayMetrics;)F", "", ApiSince=34)]
public static float ConvertPixelsToDimension (Android.Util.ComplexUnitType unitToConvertTo, float pixelValue, Android.Util.DisplayMetrics metrics);
[<Android.Runtime.Register("convertPixelsToDimension", "(IFLandroid/util/DisplayMetrics;)F", "", ApiSince=34)>]
static member ConvertPixelsToDimension : 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 just an alias of #deriveDimension(int, float, DisplayMetrics) with an easier-to-find name.

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