Android Guides | Samples

Android.Views.View.MeasureSpec Class

A MeasureSpec encapsulates the layout requirements passed from parent to child.

See Also: View+MeasureSpec

Syntax

[Android.Runtime.Register("android/view/View$MeasureSpec", DoNotGenerateAcw=true)]
public class View.MeasureSpec : Object

Remarks

A MeasureSpec encapsulates the layout requirements passed from parent to child. Each MeasureSpec represents a requirement for either the width or the height. A MeasureSpec is comprised of a size and a mode. There are three possible modes:

UNSPECIFIED
The parent has not imposed any constraint on the child. It can be whatever size it wants.
EXACTLY
The parent has determined an exact size for the child. The child is going to be given those bounds regardless of how big it wants to be.
AT_MOST
The child can be as large as it wants up to the specified size.
MeasureSpecs are implemented as ints to reduce object allocation. This class is provided to pack and unpack the <size, mode> tuple into the int.

[Android Documentation]

Requirements

Namespace: Android.Views
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1

The members of Android.Views.View.MeasureSpec are listed below.

See Also: Object

Public Constructors

Protected Constructors

A constructor used when creating managed representations of JNI objects; called by the runtime.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

static
GetMode(Int32) : MeasureSpecMode
Extracts the mode from the supplied measure specification.
static
GetSize(Int32) : Int32
Extracts the size from the supplied measure specification.
static
MakeMeasureSpec(Int32, MeasureSpecMode) : Int32
Creates a measure specification based on the supplied size and mode.
static
ToString(Int32) : String
Returns a String representation of the specified measure specification.