public final class MeasureUtils extends Object
Constructor and Description |
---|
MeasureUtils() |
Modifier and Type | Method and Description |
---|---|
static int |
getViewMeasureSpec(int sizeSpec) |
static void |
measureWithAspectRatio(int widthSpec,
int heightSpec,
float aspectRatio,
Size outputSize)
Measure according to an aspect ratio an width and height constraints.
|
static void |
measureWithAspectRatio(int widthSpec,
int heightSpec,
int intrinsicWidth,
int intrinsicHeight,
float aspectRatio,
Size outputSize)
Measure according to an aspect ratio an width and height constraints.
|
static void |
measureWithDesiredPx(int widthSpec,
int heightSpec,
int desiredWidthPx,
int desiredHeightPx,
Size outputSize)
Set the to respect both Specs and the desired width and height.
|
static void |
measureWithEqualDimens(int widthSpec,
int heightSpec,
Size outputSize)
Set the to respect both Specs and try to keep both width and height equal.
|
public static int getViewMeasureSpec(int sizeSpec)
public static void measureWithDesiredPx(int widthSpec, int heightSpec, int desiredWidthPx, int desiredHeightPx, Size outputSize)
public static void measureWithEqualDimens(int widthSpec, int heightSpec, Size outputSize)
public static void measureWithAspectRatio(int widthSpec, int heightSpec, int intrinsicWidth, int intrinsicHeight, float aspectRatio, Size outputSize)
widthSpec
- A SizeSpec for the widthheightSpec
- A SizeSpec for the heightintrinsicWidth
- A pixel value for the intrinsic width of the measured componentintrinsicHeight
- A pixel value for the intrinsic height of the measured componentaspectRatio
- The aspect ration size againstoutputSize
- The output size of this measurementpublic static void measureWithAspectRatio(int widthSpec, int heightSpec, float aspectRatio, Size outputSize)
widthSpec
- A SizeSpec for the widthheightSpec
- A SizeSpec for the heightaspectRatio
- The aspect ration size againstoutputSize
- The output size of this measurement