【发布时间】:2021-12-12 10:11:26
【问题描述】:
我在jetpack compose 中使用了BottomSheet 视图,但我想用bottomSheet 锁定屏幕,直到我们单击bottomShets 的按钮并禁用bottomSheet 中的外部触摸。我该怎么做?
我的底表:
@ExperimentalMaterialApi
@Composable
fun BottomSheet(
modifier: Modifier = Modifier,
composable: @Composable () -> Unit,
scope: CoroutineScope
) {
val bottomSheetScaffoldState = rememberBottomSheetScaffoldState(
bottomSheetState = BottomSheetState(BottomSheetValue.Expanded)
)
BottomSheetScaffold(
scaffoldState = bottomSheetScaffoldState,
sheetContent = {
Column(
Modifier
.fillMaxWidth()
.height(200.dp)
.padding(8.dp),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally
) {
Button(colors = ButtonDefaults.buttonColors(
backgroundColor = AppColor.brandColor.BLUE_DE_FRANCE,
contentColor = AppColor.neutralColor.DOCTOR
),
shape = RoundedCornerShape(
small
),
onClick = {
scope.launch {
bottomSheetScaffoldState.bottomSheetState.collapse()
}
}) {
}
}
},
sheetPeekHeight = 0.dp,
sheetShape = RoundedCornerShape(topEnd = medium, topStart = medium)
) {
composable()
}
}
可组合功能是谷歌地图屏幕
【问题讨论】:
-
你能提供底页的代码吗??
-
当然,我在问题中添加了
标签: android android-jetpack-compose android-jetpack bottom-sheet