Udostępnij za pośrednictwem


TypedArray.GetDimensionPixelOffset(Int32, Int32) Method

Definition

Retrieve a dimensional unit attribute at <var>index</var> for use as an offset in raw pixels.

[Android.Runtime.Register("getDimensionPixelOffset", "(II)I", "GetGetDimensionPixelOffset_IIHandler")]
public virtual int GetDimensionPixelOffset (int index, int defValue);
[<Android.Runtime.Register("getDimensionPixelOffset", "(II)I", "GetGetDimensionPixelOffset_IIHandler")>]
abstract member GetDimensionPixelOffset : int * int -> int
override this.GetDimensionPixelOffset : int * int -> int

Parameters

index
Int32

Index of attribute to retrieve.

defValue
Int32

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

Returns

Attribute dimension value multiplied by the appropriate metric and truncated to integer pixels, 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> for use as an offset in raw pixels. This is the same as #getDimension, except the returned value is converted to integer pixels for you. An offset conversion involves simply truncating the base value to an integer.

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

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

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.GetDimension(System.Int32%2c+System.Single)>
  • <xref:Android.Content.Res.TypedArray.GetDimensionPixelSize(System.Int32%2c+System.Int32)>