Показывать кнопку под вкладками в Jetpack ComposeAndroid

Форум для тех, кто программирует под Android
Anonymous
Показывать кнопку под вкладками в Jetpack Compose

Сообщение Anonymous »

Мне нужно отобразить кнопку под вкладками в Jetpack Compose (Android, Kotlin). У меня есть такой экран, но кнопка не отображается.
@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")
}
}
}


Подробнее здесь: https://stackoverflow.com/questions/787 ... ck-compose

Вернуться в «Android»