Humphrey
11/25/2021, 12:27 PMDidier Villevalois
11/25/2021, 1:29 PM@Composable
fun MyAppTabs() {
var tabIndex by remember { mutableStateOf(0) }
val tabTitles = listOf("Hello", "There", "World")
Column {
TabRow(selectedTabIndex = tabIndex) {
tabTitles.forEachIndexed { index, title ->
Tab(
selected = tabIndex == index,
onClick = { tabIndex = index },
text = { Text(text = title) }
)
}
}
when (tabIndex) {
0 -> Text("Hello content")
1 -> Text("There content")
2 -> Text("World content")
}
}
}
Source:
https://www.rockandnull.com/jetpack-compose-swipe-pager/Humphrey
11/25/2021, 1:34 PMKebbin
11/27/2021, 1:57 AM