Resources.GetDimensionPixelSize(Int32) Method

Definition

Retrieve a dimensional for a particular resource ID for use as a size in raw pixels.

[Android.Runtime.Register("getDimensionPixelSize", "(I)I", "GetGetDimensionPixelSize_IHandler")]
public virtual int GetDimensionPixelSize (int id);
[<Android.Runtime.Register("getDimensionPixelSize", "(I)I", "GetGetDimensionPixelSize_IHandler")>]
abstract member GetDimensionPixelSize : int -> int
override this.GetDimensionPixelSize : int -> int

Parameters

id
Int32

The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier.

Returns

Resource dimension value multiplied by the appropriate metric and truncated to integer pixels.

Attributes

Exceptions

Throws NotFoundException if the given ID does not exist.

Remarks

Retrieve a dimensional for a particular resource ID for use as a size in raw pixels. This is the same as #getDimension, except the returned value is converted to integer pixels for use as a size. A size conversion involves rounding the base value, and ensuring that a non-zero base value is at least one pixel in size.

Java documentation for android.content.res.Resources.getDimensionPixelSize(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