TypedValue.ApplyDimension(ComplexUnitType, Single, DisplayMetrics) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Converts an unpacked complex data value holding a dimension to its final floating point pixel value.
[Android.Runtime.Register("applyDimension", "(IFLandroid/util/DisplayMetrics;)F", "")]
public static float ApplyDimension (Android.Util.ComplexUnitType unit, float value, Android.Util.DisplayMetrics? metrics);
[<Android.Runtime.Register("applyDimension", "(IFLandroid/util/DisplayMetrics;)F", "")>]
static member ApplyDimension : Android.Util.ComplexUnitType * single * Android.Util.DisplayMetrics -> single
Parameters
- unit
- ComplexUnitType
The unit to convert from.
- value
- Single
The 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 an unpacked complex data value holding a dimension to its final floating point pixel value. The two parameters <var>unit</var> and <var>value</var> are as in #TYPE_DIMENSION
.
To convert the other way, e.g. from pixels to DP, use #deriveDimension(int, float, 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.