I hope It helps you.
Previously, when implementing edge-to-edge navigation or immersive mode, one of the first steps to take was to use the systemUiVisibility flags in order to request the app to be laid out fullscreen,
This new Android release deprecates this field and in order to layout the app fullscreen you have to use a new method on the Window
class: setDecorFitsSystemWindows
passing false
as an argument like below.
window.setDecorFitsSystemWindows(false)
WindowInsetsController
class which allows you to do things that previously were controlled via systemUiVisibility
flags, like hiding or showing the status bar or navigation bar(hide and show methods, respectively)
For example, you can easily show and hide the keyboard as shown below:
// You have to wait for the view to be attached to the
// window (otherwise, windowInsetController will be null)
view.doOnLayout {
view.windowInsetsController?.show(WindowInsets.Type.ime())
// You can also access it from Window
window.insetsController?.show(WindowInsets.Type.ime())
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…