MeasureUtils

Functions

Link copied to clipboard
Link copied to clipboard
fun measureResultUsingAspectRatio(widthSpec: Int, heightSpec: Int, intrinsicWidth: Int, intrinsicHeight: Int, aspectRatio: Float, layoutData: Any?): MeasureResult

Measure according to an aspect ratio an width and height constraints. This version of measureWithAspectRatio will respect the intrinsic size of the component being measured.

Link copied to clipboard
fun measureWithAspectRatio(widthSpec: Int, heightSpec: Int, aspectRatio: Float, outputSize: Size)

Measure according to an aspect ratio an width and height constraints.

fun measureWithAspectRatio(widthSpec: Int, heightSpec: Int, intrinsicWidth: Int, intrinsicHeight: Int, aspectRatio: Float, outputSize: Size)

Measure according to an aspect ratio an width and height constraints. This version of measureWithAspectRatio will respect the intrinsic size of the component being measured.

Link copied to clipboard
fun measureWithDesiredPx(widthSpec: Int, heightSpec: Int, desiredWidthPx: Int, desiredHeightPx: Int, outputSize: Size)

Set the outputSize to respect both Specs and the desired width and height. The desired size is usually the necessary pixels to render the inner content.

Link copied to clipboard
fun measureWithEqualDimens(widthSpec: Int, heightSpec: Int, outputSize: Size)

Set the outputSize to respect both size specs and try to keep both width and height equal. This will only not guarantee equal width and height if these specs use modes and sizes which prevent it.