Thread
#compose
    raenardev

    raenardev

    1 year ago
    Is there a way to ensure some element center themselves by some text center?
    @Composable
    fun TextVerticalCenter() {
        Row(verticalAlignment = CenterVertically, modifier = Modifier.background(Color.Black)) {
            Box(
                Modifier
                    .size(8.dp)
                    .background(Color.White)
            )
            Text(text = "Hello", color = Color.White, fontSize = 24.sp)
        }
    }
    If you look at screenshots, you can see that the box is slightly off center to the top (Even when all letters are same height). It is even more evident when looking at numbers. Sorry if i missed it while searching slack, but so far it seems that we have to wait for some way to turn off font padding for that:https://stackoverflow.com/questions/66126551/jetpack-compose-centering-text-without-font-padding
    Albert Chang

    Albert Chang

    1 year ago
    raenardev

    raenardev

    1 year ago
    Yes, i was referring to this. My question was about other ways to achieve this (perhaps some text center baseline in future?) - do they exists, or we have to wait for now?
    Albert Chang

    Albert Chang

    1 year ago
    I think the issue explains it. There is no equivalent now.