androidx.glance.layout

Interfaces

ColumnScope

Scope defining modifiers only available on rows.

RowScope

Scope defining modifiers only available on rows.

Classes

Alignment

A class used to specify the position of a sized box inside an available space.

Alignment.Horizontal

Specifies how a parent should lay its children out horizontally, if the child has a width smaller than the parent.

Alignment.Vertical

Specifies how a parent should lay its children out vertically, if the child has a height smaller than the parent.

ContentScale

Scaling to be used when an element is smaller than its available bounds.

Composables

Box

A layout composable with content.

Column

A layout composable with content, which lays its children out in a Column.

Row

A layout composable with content, which lays its children out in a Row.

Spacer

Component that represents an empty space layout, whose size can be defined using GlanceModifier.width, GlanceModifier.height, GlanceModifier.size modifiers.

Extension functions summary

GlanceModifier
GlanceModifier.absolutePadding(left: Dp, top: Dp, right: Dp, bottom: Dp)

Apply additional space along each edge of the content in Dp: left, top, right and bottom, ignoring the current locale's layout direction.

GlanceModifier
GlanceModifier.absolutePadding(
    left: @DimenRes Int,
    top: @DimenRes Int,
    right: @DimenRes Int,
    bottom: @DimenRes Int
)

Apply additional space along each edge of the content in Dp: left, top, right and bottom, ignoring the current locale's layout direction.

GlanceModifier

Specifies that the height of the element should expand to the size of its parent.

GlanceModifier

Set both the width and height to the maximum available space.

GlanceModifier

Specifies that the width of the element should expand to the size of its parent.

GlanceModifier

Sets the absolute height of an element, in Dp.

GlanceModifier

Set the height of the view from a resource.

GlanceModifier

Apply all dp of additional space along each edge of the content, left, top, right and bottom.

GlanceModifier

Apply all dp of additional space along each edge of the content, left, top, right and bottom.

GlanceModifier
GlanceModifier.padding(horizontal: Dp, vertical: Dp)

Apply horizontal dp space along the left and right edges of the content, and vertical dp space along the top and bottom edges.

GlanceModifier
GlanceModifier.padding(horizontal: @DimenRes Int, vertical: @DimenRes Int)

Apply horizontal dp space along the left and right edges of the content, and vertical dp space along the top and bottom edges.

GlanceModifier
GlanceModifier.padding(start: Dp, top: Dp, end: Dp, bottom: Dp)

Apply additional space along each edge of the content in Dp: start, top, end and bottom.

GlanceModifier
GlanceModifier.padding(
    start: @DimenRes Int,
    top: @DimenRes Int,
    end: @DimenRes Int,
    bottom: @DimenRes Int
)

Apply additional space along each edge of the content in Dp: start, top, end and bottom.

GlanceModifier

Sets both the width and height of an element, in Dp.

GlanceModifier

Sets both width and height of an element from a resource.

GlanceModifier
GlanceModifier.size(width: Dp, height: Dp)

Sets both the width and height of an element, in Dp.

GlanceModifier
GlanceModifier.size(width: @DimenRes Int, height: @DimenRes Int)

Sets both the width and height of an element from resources.

GlanceModifier

Sets the absolute width of an element, in Dp.

GlanceModifier

Set the width of a view from the value of a resource.

GlanceModifier

Specifies that the height of the element should wrap its contents.

GlanceModifier

Wrap both the width and height's content.

GlanceModifier

Specifies that the width of the element should wrap its contents.

Extension functions

GlanceModifier.absolutePadding

fun GlanceModifier.absolutePadding(
    left: Dp = 0.dp,
    top: Dp = 0.dp,
    right: Dp = 0.dp,
    bottom: Dp = 0.dp
): GlanceModifier

Apply additional space along each edge of the content in Dp: left, top, right and bottom, ignoring the current locale's layout direction.

GlanceModifier.absolutePadding

fun GlanceModifier.absolutePadding(
    left: @DimenRes Int = 0,
    top: @DimenRes Int = 0,
    right: @DimenRes Int = 0,
    bottom: @DimenRes Int = 0
): GlanceModifier

Apply additional space along each edge of the content in Dp: left, top, right and bottom, ignoring the current locale's layout direction.

GlanceModifier.fillMaxHeight

fun GlanceModifier.fillMaxHeight(): GlanceModifier

Specifies that the height of the element should expand to the size of its parent. Note that if multiple elements within a linear container (e.g. Row or Column) have their height as expandHeight, then they will all share the remaining space.

GlanceModifier.fillMaxSize

fun GlanceModifier.fillMaxSize(): GlanceModifier

Set both the width and height to the maximum available space.

GlanceModifier.fillMaxWidth

fun GlanceModifier.fillMaxWidth(): GlanceModifier

Specifies that the width of the element should expand to the size of its parent. Note that if multiple elements within a linear container (e.g. Row or Column) have their width as fillMaxWidth, then they will all share the remaining space.

GlanceModifier.height

fun GlanceModifier.height(height: Dp): GlanceModifier

Sets the absolute height of an element, in Dp.

GlanceModifier.height

fun GlanceModifier.height(height: @DimenRes Int): GlanceModifier

Set the height of the view from a resource.

GlanceModifier.padding

fun GlanceModifier.padding(all: Dp): GlanceModifier

Apply all dp of additional space along each edge of the content, left, top, right and bottom.

GlanceModifier.padding

fun GlanceModifier.padding(all: @DimenRes Int): GlanceModifier

Apply all dp of additional space along each edge of the content, left, top, right and bottom.

GlanceModifier.padding

fun GlanceModifier.padding(horizontal: Dp = 0.dp, vertical: Dp = 0.dp): GlanceModifier

Apply horizontal dp space along the left and right edges of the content, and vertical dp space along the top and bottom edges.

If any value is not defined, it will be 0.dp or whatever value was defined by an earlier modifier.

GlanceModifier.padding

fun GlanceModifier.padding(horizontal: @DimenRes Int = 0, vertical: @DimenRes Int = 0): GlanceModifier

Apply horizontal dp space along the left and right edges of the content, and vertical dp space along the top and bottom edges.

If any value is not defined, it will be 0.dp or whatever value was defined by an earlier modifier.

GlanceModifier.padding

fun GlanceModifier.padding(
    start: Dp = 0.dp,
    top: Dp = 0.dp,
    end: Dp = 0.dp,
    bottom: Dp = 0.dp
): GlanceModifier

Apply additional space along each edge of the content in Dp: start, top, end and bottom. The start and end edges will be determined by layout direction of the current locale. Padding is applied before content measurement and takes precedence; content may only be as large as the remaining space.

If any value is not defined, it will be 0.dp or whatever value was defined by an earlier modifier.

GlanceModifier.padding

fun GlanceModifier.padding(
    start: @DimenRes Int = 0,
    top: @DimenRes Int = 0,
    end: @DimenRes Int = 0,
    bottom: @DimenRes Int = 0
): GlanceModifier

Apply additional space along each edge of the content in Dp: start, top, end and bottom. The start and end edges will be determined by layout direction of the current locale. Padding is applied before content measurement and takes precedence; content may only be as large as the remaining space.

If any value is not defined, it will be 0.dp or whatever value was defined by an earlier modifier.

GlanceModifier.size

fun GlanceModifier.size(size: Dp): GlanceModifier

Sets both the width and height of an element, in Dp.

GlanceModifier.size

fun GlanceModifier.size(size: @DimenRes Int): GlanceModifier

Sets both width and height of an element from a resource.

GlanceModifier.size

fun GlanceModifier.size(width: Dp, height: Dp): GlanceModifier

Sets both the width and height of an element, in Dp.

GlanceModifier.size

fun GlanceModifier.size(width: @DimenRes Int, height: @DimenRes Int): GlanceModifier

Sets both the width and height of an element from resources.

GlanceModifier.width

fun GlanceModifier.width(width: Dp): GlanceModifier

Sets the absolute width of an element, in Dp.

GlanceModifier.width

fun GlanceModifier.width(width: @DimenRes Int): GlanceModifier

Set the width of a view from the value of a resource.

GlanceModifier.wrapContentHeight

fun GlanceModifier.wrapContentHeight(): GlanceModifier

Specifies that the height of the element should wrap its contents.

GlanceModifier.wrapContentSize

fun GlanceModifier.wrapContentSize(): GlanceModifier

Wrap both the width and height's content.

GlanceModifier.wrapContentWidth

fun GlanceModifier.wrapContentWidth(): GlanceModifier

Specifies that the width of the element should wrap its contents.