Stick this in your fullscreen Activities
Poorly written by hailey on May 6, 2025Who knows if this is "right". I don't care. Just stick this in your fullscreen Activites to avoid pain and sorrow every time you create a new one.
ViewCompat.setOnApplyWindowInsetsListener(root) { view, insets ->
val systemBarsInsets = insets.getInsets(WindowInsetsCompat.Type.navigationBars())
view.setPadding(0, systemBarsInsets.top, 0, systemBarsInsets.bottom)
insets
}
// 31 or higher
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
window.insetsController?.let {
it.systemBarsBehavior = android.view.WindowInsetsController.BEHAVIOR_DEFAULT
}
} else {
@Suppress("DEPRECATION")
window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
}