how to make buttons same sized in jetpack compose
- User
how to make buttons same sized in jetpack compose
- Assistant
To make buttons the same size in Jetpack Compose, you can use the
Modifierattributewidthandheightto give them a fixed value. Here is an example:codeRow(Modifier.fillMaxWidth()) { Button( modifier = Modifier .width(120.dp) .height(60.dp), onClick = { /* do something */ } ) { Text(text = "Button 1") } Button( modifier = Modifier .width(120.dp) .height(60.dp), onClick = { /* do something */ } ) { Text(text = "Button 2") } }In this example, both buttons will have a width of 120dp and a height of 60dp, making them the same size. You can adjust the values to make the buttons larger or smaller as needed.
- User
same sized buttons in row and two columns jetapack compose
- Assistant
To make same-sized buttons in a row and two columns in Jetpack Compose, you can use the
BoxandColumncomposables to create a layout for each column, then use theModifierattributesweightandfillMaxHeightto make the columns and buttons the same size. Here is an example: