Kotlin - removes spaces around buttons

32 Views Asked by At

I'm playing around with the code. Below is my code, and it seems like there's some default spacing causing the buttons to be separated. I would like to remove the spaces, so button "A" sits right on top of button "B". Could someone help me with this?

Thanks.

fun MyUserInterface(){
Column(modifier = Modifier
    .fillMaxSize()
    .padding(32.dp)
    .border(BorderStroke(2.dp, Color.Red))){
        Button(onClick = { /*TODO*/ }) {
            Text(text = "A")
        }
        Button(onClick = { /*TODO*/ }) {
            Text(text = "B")
        }
        Button(onClick = { /*TODO*/ }) {
            Text(text = "C")
        }
        Button(onClick = { /*TODO*/ }) {
            Text(text = "D")
        }
        Button(onClick = { /*TODO*/ }) {
            Text(text = "E")
        }
}

}

1

There are 1 best solutions below

1
Jan Itor On BEST ANSWER

To modify spacing for the whole column use Arrangement.spacedBy:

Column(
    verticalArrangement = Arrangement.spacedBy((-8).dp),