我已尝试从本文中进行伴奏库导航,并且我想防止当我单击底部工作表的背景(灰色区域)时关闭底部工作表并使其根本不可单击,我该如何实现这一点?
这是链接中的代码
@Composable
fun MyApp() {
val navController = rememberNavController()
val bottomSheetNavigator = rememberBottomSheetNavigator()
navController.navigatorProvider += bottomSheetNavigator
ModalBottomSheetLayout(
bottomSheetNavigator = bottomSheetNavigator
) {
NavHost(navController, startDestination = "home") {
composable(route = "home") {
Button(onClick = { navController.navigate("sheet") }) {
Text("Click me to see something cool!")
}
}
bottomSheet(route = "sheet") {
Text("This is a cool bottom sheet!")
Button(onClick = { navController.navigate("home") }) {
Text("Take me back, please!")
}
Spacer(modifier = Modifier.padding(200.dp))
}
}
}
}
Run Code Online (Sandbox Code Playgroud) android-jetpack-navigation android-jetpack-compose jetpack-compose-accompanist