java.lang.Object | |
↳ | android.view.View.MeasureSpec |
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:
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | AT_MOST | Measure specification mode: The child can be as large as it wants up to the specified size. | |||||||||
int | EXACTLY | Measure specification mode: The parent has determined an exact size for the child. | |||||||||
int | UNSPECIFIED | Measure specification mode: The parent has not imposed any constraint on the child. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Extracts the mode from the supplied measure specification.
|
||||||||||
|
Extracts the size from the supplied measure specification.
|
||||||||||
|
Creates a measure specification based on the supplied size and mode.
|
||||||||||
|
Returns a String representation of the specified measure
specification.
|
[Expand]
Inherited Methods
|
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Measure specification mode: The child can be as large as it wants up to the specified size.
Measure specification mode: 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.
Measure specification mode: The parent has not imposed any constraint on the child. It can be whatever size it wants.
Extracts the mode from the supplied measure specification.
measureSpec | the measure specification to extract the mode from |
---|
UNSPECIFIED
,
AT_MOST
or
EXACTLY
Extracts the size from the supplied measure specification.
measureSpec | the measure specification to extract the size from |
---|
Creates a measure specification based on the supplied size and mode. The mode must always be one of the following:
Note:
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.
RelativeLayout
was affected by this bug.
Apps targeting API levels greater than 17 will get the fixed, more strict
behavior.
size | the size of the measure specification |
---|---|
mode | the mode of the measure specification |
Returns a String representation of the specified measure specification.
measureSpec | the measure specification to convert to a String |
---|