Tin Tran
06/03/2021, 10:06 AMTin Tran
06/03/2021, 10:06 AM@Composable
@Preview
fun Test() {
var showLoading by remember { mutableStateOf(true) }
Box(
modifier = Modifier.fillMaxSize().background(Color.White)
) {
Button(onClick = {showLoading = !showLoading}) {
Text(text = "Show loading")
}
if (showLoading) {
Box(modifier = Modifier.fillMaxSize().background(Color(0x33000000))) {
CircularProgressIndicator(
color = Color.White,
strokeWidth = 2.dp,
modifier = Modifier
.align(Alignment.Center)
)
}
}
}
}
Albert Chang
06/03/2021, 10:25 AMAlbert Chang
06/03/2021, 10:27 AMSurface
instead of a Box
.Tin Tran
06/03/2021, 10:43 AMSurface
or consume the touch event myself with Modifier.pointerInput(Unit) { detectTapGestures { } }