Insets of system views (e.g. status bar, navigation bar), that are applied to the window of activity.
Questions tagged [windowinsets]
70 questions
43
votes
3 answers
What are WindowInsets?
I am trying to learn about the Android OS and while I was reading the Google I/O 2014 app, I came across the WindowInsets. If anyone can explain what they are then it would be a great help. Thank you.

Samvid Mistry
- 783
- 1
- 8
- 14
23
votes
14 answers
setOnApplyWindowInsetsListener never called
I would like to calculate the navigationBar height. I've seen this presentation : https://chris.banes.me/talks/2017/becoming-a-master-window-fitter-nyc/
So, I tried to use the method View.setOnApplyWindowInsetsListener().
But, for some reason, it's…

Belgikoi
- 565
- 2
- 5
- 13
18
votes
2 answers
Android API level 30 setSystemBarsAppearance doesn't overwrite theme data
Pre-Android 11 (API Level 30) I had
- true
set in my theme and was additionally changing this (when needed) in the the code with
fun setLightStatusBar(){
window?.decorView?.let {…

Viktor Stojanov
- 708
- 6
- 20
12
votes
3 answers
How to adjust dialog layout when soft keyboard appears using the latest WindowInset API
Question:
How to use the latest WindowInset API to adjust space betweeen my dialog and softkeyboard?
I have a BottomSheetDialog with some EditText. The default animation will show the soft keyboard right below my EditText which will cover my save…

JosephW
- 253
- 1
- 2
- 10
11
votes
2 answers
OnApplyWindowInsetsListener gives systemWindowInsetBottom that is always 0
systemWindowInsetBottom AND stableInsetBottom are both always 0
I have an Activity, that has a background texture, and I am using FLAG_LAYOUT_NO_LIMITS to let that background go behind the status and navigation bar. But I don't want the other…

lbenedetto
- 2,022
- 1
- 21
- 39
9
votes
7 answers
NULL Window Insets
I am trying to get the DisplayCutout and getting a
java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.DisplayCutout android.view.WindowInsets.getDisplayCutout()' on a null object reference
Here is my code:
if…

slackwars
- 504
- 5
- 18
9
votes
3 answers
Nested co-ordinate layout and fitsSystemWindows overlaps status bar
Following is xml for my Main activity

amodkanthe
- 4,345
- 6
- 36
- 77
8
votes
0 answers
SOFT_INPUT_ADJUST_RESIZE deprecated. But other flags are not. What is the new recommended way of changing inputType mode at runtime?
In my app I use single activity - MainActivity with multiple fragments. In Manifest file I set activity's windowSoftInputMode to adjustResize because I need that behaviour in majority of fragments where keyboard is shown.

Marat
- 6,142
- 6
- 39
- 67
8
votes
3 answers
Show keyboard over Scaffold's bottomBar in Jetpack Compose and apply proper inset paddings
I'm using Scaffold for my main screen with a fixed bottomBar that is visible in every screen of the app, and I'm applying the innerPadding of the Scaffold to its content.
I want the keyboard to appear over the bottomBar, and for that I'm applying…

rewgoes
- 656
- 2
- 9
- 23
8
votes
0 answers
Navigation Component FragmentContainerView does not play well with fitsSystemWindows=true
I've been working on updating my best practices showcase app with the latest Android Architecture Components, and ran into this issue.
I'm using the Navigation Component and fragments to create my screens. As I prefer to manage my window insets…

fonix232
- 2,132
- 6
- 39
- 69
6
votes
1 answer
setOnApplyWindowInsetsListener - statusBar color problem
Why when I use
setOnApplyWindowInsetsListener
statusBar color disappears?
fun isKeyboardVisible(view: View) {
ViewCompat.setOnApplyWindowInsetsListener(view) { view, windowInsets ->
val isKeyboardVisible =…

pat20036
- 83
- 6
6
votes
1 answer
How to apply fitsSystemWindows on Fragment pages of a ViewPager?
I can't get my pages of my ViewPager respect the statusbar height.
My ViewPager has several pages, on one of them there is an image that needs to go under the translucent statusbar. The rest of the pages only require a coloured statusbar, so my idea…

Rubenski
- 237
- 4
- 9
5
votes
0 answers
Right way to get system insets
I have been using view.rootWindowInsets.stableInsetTop and bottom to get the height of the status and navigation bars, however this is now deprecated and the docs advise to…

Madushan
- 6,977
- 31
- 79
5
votes
2 answers
Android 11 - window.setDecorFitsSystemWindow doesn't show screen behind Status and Navigation Bars
I'm trying to update my App to Android 11. Many Screens of my App were Designed with App Content behind the StatusBar. I Updated my gradle to Android 11 and started updating the Window code to get the No Limit behavior also for Android 11 Devices.
I…

Distra
- 2,260
- 2
- 14
- 23
5
votes
1 answer
Is there a way to prevent a layout from "jumping" when the status bar is being hidden?
I'm trying to implement a photo viewer in my app using a view pager. I'm able to get the system UI to disappear (both navigation and status bar) on a single touch. The only issue I'm having is that my layout on my view pager begins to shake or jump…

antWilder
- 125
- 1
- 11