georgiecasey
georgiecasey

Reputation: 23391

How do I align an icon in the top left of a Column that has verticalArrangement of Center

As title says, I have a compose Column where I center the contents vertically but I want an icon in top left.

Upvotes: 0

Views: 64

Answers (1)

BenjyTec
BenjyTec

Reputation: 10992

If you want the Column content be centered in the screen without having any offset from the Icon on the top, then use a Box as suggested in the comments:

Box(
    modifier = Modifier.fillMaxSize()
) {
    Column(
        modifier = Modifier.matchParentSize(),
        verticalArrangement = Arrangement.Center
    ) {
        // ...
    }
    Icon(
        modifier = Modifier.align(Alignment.TopStart)
    )
}

Note that with this approach, the Icon could overlap the Column items when the Column is filling the full screen height.

Upvotes: 1

Related Questions