How to set button height and width in Jetpack Compose? I can't set button height and width.
Button(onClick = { },
modifier = Modifier.size(width = 80.dp,height = 80.dp)
) {
Text(text = "Lorem")
}
How to set button height and width in Jetpack Compose? I can't set button height and width.
Button(onClick = { },
modifier = Modifier.size(width = 80.dp,height = 80.dp)
) {
Text(text = "Lorem")
}
You have to use Column
, Row
or any other layout. Read more about in here about Layouts. Basic Layouts comes from here.
@Preview(showBackground = true)
@Composable
fun ButtonView() {
Column(modifier = Modifier.fillMaxSize().background(Color.Yellow)) {
Button(
onClick = { },
modifier = Modifier.size(width = 80.dp, height = 80.dp)
) {
Text(text = "Lorem")
}
}
}
Output