I need to show a button below tabs in Jetpack Compose (Android, Kotlin)I have a screen like so, but the button os not shown up.
@Composable
fun MainScreen() {
var tabIndex by remember { mutableStateOf(0) }
val tabs = listOf("Accounts", "Documents")
Column(modifier = Modifier.fillMaxWidth()) {
TabRow(selectedTabIndex = tabIndex) {
tabs.forEachIndexed { index, title ->
Tab(text = { Text(title) },
selected = tabIndex == index,
onClick = { tabIndex = index },
)
}
}
when (tabIndex) {
0 -> AccountsScreen()
1 -> DocumentsScreen()
}
Spacer(modifier = Modifier.weight(1f)) // Pushes the button to the bottom
Button(
onClick = { /*TODO*/ },
modifier = Modifier
.fillMaxWidth()
.padding(16.dp)
) {
Text("Change Master Password")
}
}
}