Condividi tramite


TypedArray.GetDimension(Int32, Single) Method

Definition

Retrieve a dimensional unit attribute at <var>index</var>.

[Android.Runtime.Register("getDimension", "(IF)F", "GetGetDimension_IFHandler")]
public virtual float GetDimension (int index, float defValue);
[<Android.Runtime.Register("getDimension", "(IF)F", "GetGetDimension_IFHandler")>]
abstract member GetDimension : int * single -> single
override this.GetDimension : int * single -> single

Parameters

index
Int32

Index of attribute to retrieve.

defValue
Single

Value to return if the attribute is not defined or not a resource.

Returns

Attribute dimension value multiplied by the appropriate metric, or defValue if not defined.

Attributes

Exceptions

if the TypedArray has already been recycled.

if the attribute is defined but is not an integer.

Remarks

Retrieve a dimensional unit attribute at <var>index</var>. Unit conversions are based on the current DisplayMetrics associated with the resources this TypedArray object came from.

This method will throw an exception if the attribute is defined but is not a dimension.

Java documentation for android.content.res.TypedArray.getDimension(int, float).

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

See also

  • <xref:Android.Content.Res.TypedArray.GetDimensionPixelOffset(System.Int32%2c+System.Int32)>
  • <xref:Android.Content.Res.TypedArray.GetDimensionPixelSize(System.Int32%2c+System.Int32)>