Udostępnij za pośrednictwem


Resources.GetDimension(Int32) Method

Definition

Retrieve a dimensional for a particular resource ID.

[Android.Runtime.Register("getDimension", "(I)F", "GetGetDimension_IHandler")]
public virtual float GetDimension (int id);
[<Android.Runtime.Register("getDimension", "(I)F", "GetGetDimension_IHandler")>]
abstract member GetDimension : int -> single
override this.GetDimension : int -> single

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 to convert to pixels.

Attributes

Exceptions

Throws NotFoundException if the given ID does not exist.

Remarks

Retrieve a dimensional for a particular resource ID. Unit conversions are based on the current DisplayMetrics associated with the resources.

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