Compartilhar via


View.MeasureSpec.MakeMeasureSpec(Int32, MeasureSpecMode) Method

Definition

Creates a measure specification based on the supplied size and mode.

[Android.Runtime.Register("makeMeasureSpec", "(II)I", "")]
public static int MakeMeasureSpec (int size, Android.Views.MeasureSpecMode mode);
[<Android.Runtime.Register("makeMeasureSpec", "(II)I", "")>]
static member MakeMeasureSpec : int * Android.Views.MeasureSpecMode -> int

Parameters

size
Int32

the size of the measure specification

mode
MeasureSpecMode

the mode of the measure specification

Returns

the measure specification based on size and mode

Attributes

Remarks

Creates a measure specification based on the supplied size and mode.

The mode must always be one of the following: <ul> <li>android.view.View.MeasureSpec#UNSPECIFIED</li> <li>android.view.View.MeasureSpec#EXACTLY</li> <li>android.view.View.MeasureSpec#AT_MOST</li> </ul>

<strong>Note:</strong> On API level 17 and lower, makeMeasureSpec's implementation was such that the order of arguments did not matter and overflow in either value could impact the resulting MeasureSpec. android.widget.RelativeLayout was affected by this bug. Apps targeting API levels greater than 17 will get the fixed, more strict behavior.

Java documentation for android.view.View.MeasureSpec.makeMeasureSpec(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