Заранее спасибо.@Composable
fun MyApp() {
val tabs = listOf("Home", "Contact")
var selectedTab by remember { mutableStateOf(0) }
var headerVisible by remember { mutableStateOf(true) } // Control header visibility
val animatedAlpha by animateFloatAsState(if (headerVisible) 1f else 0f)
Column {
//
if (animatedAlpha > 0f) {
Header()
}
// Tabs
TabRow(
selectedTabIndex = selectedTab,
backgroundColor = Color.White, //
modifier = Modifier
.fillMaxWidth()
.offset(y = 0.dp) //
.zIndex(1f) //
) {
tabs.forEachIndexed { index, title ->
Tab(
selected = selectedTab == index,
onClick = { selectedTab = index },
selectedContentColor = Color(0xff1f68da), //
unselectedContentColor = Color.Gray, //
text = {
Text(
text = title,
fontFamily = customFontFamily,
fontWeight = FontWeight.Normal,
color = if (selectedTab == index) Color(0xff1f68da) else Color.Gray
)
}
)
}
}
// WebView Content Based on Selected Tab
when (selectedTab) {
0 -> HomeView { scrollDiff -> headerVisible = scrollDiff ContactView { scrollDiff -> headerVisible = scrollDiff Unit) {
WebViewPage(url = "https://www.google.com”, onScroll = onScroll)
}
Подробнее здесь: https://stackoverflow.com/questions/795 ... -in-kotlin
Мобильная версия