public class SurfaceView.ViewAspectRatioMeasurer
extends java.lang.Object
Constructor and Description |
---|
ViewAspectRatioMeasurer() |
Modifier and Type | Method and Description |
---|---|
double |
getAspectRatio() |
int |
getMeasuredHeight()
Get the height measured in the latest call to measure().
|
int |
getMeasuredWidth()
Get the width measured in the latest call to measure().
|
void |
measure(int widthMeasureSpec,
int heightMeasureSpec)
Measure with the aspect ratio given at construction.
After measuring, get the width and height with the getMeasuredWidth()
and getMeasuredHeight() methods, respectively. |
void |
measure(int widthMeasureSpec,
int heightMeasureSpec,
double aspectRatio)
Measure with a specific aspect ratio
After measuring, get the width and height with the getMeasuredWidth()
and getMeasuredHeight() methods, respectively. |
void |
setAspectRatio(double aspectRatio) |
public void setAspectRatio(double aspectRatio)
public double getAspectRatio()
public void measure(int widthMeasureSpec, int heightMeasureSpec)
getMeasuredWidth()
and getMeasuredHeight()
methods, respectively.widthMeasureSpec
- The width MeasureSpec passed in your View.onMeasure() methodheightMeasureSpec
- The height MeasureSpec passed in your View.onMeasure() methodpublic void measure(int widthMeasureSpec, int heightMeasureSpec, double aspectRatio)
getMeasuredWidth()
and getMeasuredHeight()
methods, respectively.widthMeasureSpec
- The width MeasureSpec passed in your View.onMeasure() methodheightMeasureSpec
- The height MeasureSpec passed in your View.onMeasure() methodaspectRatio
- The aspect ratio to calculate measurements in respect topublic int getMeasuredWidth()
public int getMeasuredHeight()