I hided the navigationbar in jetpack compose.
But, when i show a dialog, the navigationbar also shows.
I want to hide the navigationbar when showing the dialog.
Please see GIF animation for details
Please let me know if you have a good idea.
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
SampleComposeTheme {
var showDialog by remember { mutableStateOf(false) }
OutlinedButton(
onClick = { showDialog = true }
) {
Text("Button")
}
if (showDialog) {
AlertDialog(
onDismissRequest = {},
text = {
Text("Alert")
},
confirmButton = {
Button(onClick = { showDialog = false }) {
Text("ConfirmButton")
}
}
)
}
}
}
window.insetsController?.apply {
hide(WindowInsets.Type.navigationBars())
systemBarsBehavior =
WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
}
}
}
