我正在尝试在底部导航上制作一个简单的动画
这是代码:
@Composable
private fun BottomNavImpl() {
Scaffold(
bottomBar = {
var isBottomBarVisible: Boolean by remember { mutableStateOf(false) }
LaunchedEffect(Unit) {
delay(2000)
isBottomBarVisible = true
}
AnimatedVisibility(
visible = isBottomBarVisible,
enter = slideInVertically(
initialOffsetY = { it },
animationSpec = tween(
durationMillis = 500,
easing = FastOutSlowInEasing
)
),
exit = slideOutVertically(
targetOffsetY = { it },
animationSpec = tween(
durationMillis = 300,
easing = FastOutSlowInEasing
)
)
) {
NavigationBar(
containerColor = Color.Red,
) {
repeat(3) {
NavigationBarItem(
icon = {
Icon(
modifier = Modifier,
painter = painterResource(android.R.drawable.ic_menu_add),
contentDescription = null,
)
},
selected = false,
onClick = { }
)
}
}
}
},
content = { paddingValues ->
Box(
modifier = Modifier
.fillMaxSize()
.padding(paddingValues)
.background(Color.Green)
) {
}
}
)
}
这是结果
问题是在动画过程中,后面出现白色背景