The second Android 11 Developer Preview is now available, test it out and share your feedback.

LayoutHeight

@Stable data class LayoutHeight : LayoutModifier
kotlin.Any
   ↳ androidx.ui.layout.LayoutHeight

Modifies the height of a Compose UI layout element. LayoutHeight(16.dp) will instruct the layout element to be exactly 16dp tall if permitted by its parent.

This modifies the incoming Constraints provided by a layout element's parent. If the incoming constraints do not allow the modified size, the incoming constraints from the parent will restrict the final size.

See Min, Max, Constrain and Fill to modify the height of a layout element within a range rather than to an exact size. See LayoutWidth to modify width, or LayoutSize to modify both width and height at once.

Example usage:

import androidx.ui.foundation.Box
import androidx.ui.layout.Center
import androidx.ui.layout.LayoutAspectRatio
import androidx.ui.layout.LayoutHeight

Center {
    Box(LayoutHeight(100.dp) + LayoutAspectRatio(1f), backgroundColor = Color.Blue)
}

Summary

Nested classes

data

Modifies the height of a Compose UI layout element to be at least minHeight and at most maxHeight tall if permitted by its parent.

Modifies the height of a Compose UI layout element to fill all available space.

data

Modifies the height of a Compose UI layout element to be at most maxHeight tall if permitted by its parent.

data

Modifies the height of a Compose UI layout element to be at least minHeight tall if permitted by its parent.

Public constructors

<init>(height: Dp)

Modifies the height of a Compose UI layout element.

Properties

Dp

Public constructors

<init>

LayoutHeight(height: Dp)

Modifies the height of a Compose UI layout element. LayoutHeight(16.dp) will instruct the layout element to be exactly 16dp tall if permitted by its parent.

This modifies the incoming Constraints provided by a layout element's parent. If the incoming constraints do not allow the modified size, the incoming constraints from the parent will restrict the final size.

See Min, Max, Constrain and Fill to modify the height of a layout element within a range rather than to an exact size. See LayoutWidth to modify width, or LayoutSize to modify both width and height at once.

Example usage:

import androidx.ui.foundation.Box
import androidx.ui.layout.Center
import androidx.ui.layout.LayoutAspectRatio
import androidx.ui.layout.LayoutHeight

Center {
    Box(LayoutHeight(100.dp) + LayoutAspectRatio(1f), backgroundColor = Color.Blue)
}

Properties

height

val height: Dp