When I use fullscreen with cutout, i have next
screen. How fix this?
Cutout:
window.attributes.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
Fullscreen:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
if (visible) {
window.decorView.systemUiVisibility = (View.SYSTEM_UI_FLAG_LAYOUT_STABLE
or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
)
} else {
window.decorView.systemUiVisibility = (View.SYSTEM_UI_FLAG_LAYOUT_STABLE
or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // прячем панель навигации
or View.SYSTEM_UI_FLAG_FULLSCREEN // прячем строку состояния
or View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY)
}
}
Transparent
val color = ContextCompat.getColor(this, R.color.transparent_dark)
window.statusBarColor = color
window.navigationBarColor = color
ActionBar by default (not custom Toolbar):
<style name="AppTheme.Viewer" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="windowActionModeOverlay">true</item>
<item name="actionBarStyle">@style/MyTheme.ActionBar</item>
</style>
<style name="MyTheme.ActionBar" parent="Widget.AppCompat.ActionBar">
<item name="elevation" tools:targetApi="lollipop">0dp</item>
<item name="background">@color/transparent_dark</item>
</style>
Google not helped me.
By default, the actionbar processes WindowInsets and adds padding where the system elements should be (statusbar, navigationbar and cutout like mine). If you add your actionbar to the layout, you can decide how to handle WindowInsets yourself.