Repository navigation
Android 15 system window insets #137
Description
Nav bar obscures keyboard when used on Android 15
When running on a device running API 35 or above, the keyboard is partially obscured by system bars. This issue also affects the main activity.
Symptoms
Running on an emulator with an API level 35 image, or on my phone, the main activity and keyboard are obscured.
This is the activity with its content scrolled up as far as it will go:
and in landscape:
And here is the keyboard:
This also affects the default keyboard in the emulator's system image (which is an AOSP one without Google Play). It does not affect the default Samsung keyboard on my phone.
Cause
Android 15 puts apps in "edge to edge" mode, where they are drawn under the system bars and must adjust their padding accordingly.
That explains the obscured parts of the views, but I have no idea why the phenomenon in the second last image occurs, where the left edge of the keyboard is not obscured but the width seems not to be sufficiently narrower to fit it all on screen.
Attempted fix
I am not very familiar with Android development, so I have been down a rabbit hole trying to fix this.
The first thing I tried, is reverting targetSdk to 34. I thought that Android would try to make older apps work as if they were running on an older version of Android. That did not work. Of course that would not be a real solution anyway, long term.
edit: There was a paragraph here about my misunderstanding of WindowInsets, specifically arising from the fact that I thought WindowInsets.getInsets(int) returned a WindowInsets, but it returns an Insets
In any case, it didn't work.
But it seems there is also a fitsSystemWindows attribute of views which can be set in a layout file or at runtime. That fixes the activity views, but not the keyboard. I think it may be to do with the keyboard being inside a subclass of Dialog called SoftInputWindow, which is used by the InputMethodService class. Perhaps that doesn't get WindowInsets applied automatically. I have no idea.
Here is the tiny patch that adds fitsSystemWindows everywhere: larrychips/codeboard@c552594
diff --git a/app/src/main/java/com/gazlaws/codeboard/layout/ui/KeyboardUiFactory.java b/app/src/main/java/com/gazlaws/codeboard/layout/ui/KeyboardUiFactory.java
index 8010be4..5922d34 100644
--- a/app/src/main/java/com/gazlaws/codeboard/layout/ui/KeyboardUiFactory.java
+++ b/app/src/main/java/com/gazlaws/codeboard/layout/ui/KeyboardUiFactory.java
@@ -31,6 +31,7 @@ public class KeyboardUiFactory {
View view = createKeyView(context, key, uiTheme);
layout.addView(view,params);
}
+ layout.setFitsSystemWindows(true);
return layout;
}
diff --git a/app/src/main/res/layout/codeboard_intro1.xml b/app/src/main/res/layout/codeboard_intro1.xml
index d24bc51..5914d19 100644
--- a/app/src/main/res/layout/codeboard_intro1.xml
+++ b/app/src/main/res/layout/codeboard_intro1.xml
@@ -3,7 +3,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimaryDark"
- android:orientation="vertical">
+ android:orientation="vertical"
+ android:fitsSystemWindows="true">
<TextView
android:layout_width="wrap_content"
@@ -43,4 +44,4 @@
android:layout_marginBottom="64dp"
android:src="@drawable/enable_screenshot" />
-</LinearLayout>
\ No newline at end of file
+</LinearLayout>
diff --git a/app/src/main/res/layout/codeboard_intro2.xml b/app/src/main/res/layout/codeboard_intro2.xml
index 3a80e75..78a39b2 100644
--- a/app/src/main/res/layout/codeboard_intro2.xml
+++ b/app/src/main/res/layout/codeboard_intro2.xml
@@ -3,7 +3,8 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="@color/colorPrimaryDark">
+ android:background="@color/colorPrimaryDark"
+ android:fitsSystemWindows="true">
<TextView
android:layout_margin="48dp"
android:textStyle="bold"
@@ -33,4 +34,4 @@
android:src="@drawable/icon_large"
android:layout_marginBottom="64dp"/>
-</LinearLayout>
\ No newline at end of file
+</LinearLayout>
diff --git a/app/src/main/res/layout/new_activity_main.xml b/app/src/main/res/layout/new_activity_main.xml
index 2a09f1a..ed1d87a 100644
--- a/app/src/main/res/layout/new_activity_main.xml
+++ b/app/src/main/res/layout/new_activity_main.xml
@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
- android:layout_height="match_parent">
+ android:layout_height="match_parent"
+ android:fitsSystemWindows="true">
<FrameLayout
android:id="@+id/settings_container"
android:layout_width="match_parent"
android:layout_height="match_parent">
</FrameLayout>
-</LinearLayout>
\ No newline at end of file
+</LinearLayout>
Activity
larrychips commentedon Jul 26, 2025
Sorry, I said "in the last image" when I was not referring to the last image.
CloCkWeRX commentedon Sep 9, 2025
this affects the ux on my pixel
CloCkWeRX commentedon Sep 9, 2025
Annoyingly cant create a PR as not a collaborator.
https://github.com/gazlaws-dev/codeboard/compare/gazlaws-dev:master...larrychips:set-fits?expand=1
Joe0lsen commentedon Nov 8, 2025
Would love to see this issue resolved! 🙏
Log the correct insets.
larrychips commentedon Nov 20, 2025
My phone just got a system update from Samsung, and am now on Android 16.
Codeboard's actual keyboard works fine now, but the activity views still need their fitsSystemWindows properties setting.
It seems that the other half of the fix might only need to apply when on api level 35 (not above or below).
It's a bit ugly, but it would mean telling codeboard's KeyboardLayoutView to add padding corresponding to the window right inset, reducing its width by the left inset, and adding bottom padding for the bottom inset, and ignoring the top inset. Again, this is only to be done when android.os.Build.SDK_INT == 35. This is a horrible kludge but it is simple and only applies when running on this one version of Android. It also only works if everyone is seeing exactly the same symptoms; obscured right edge if there is a system bar there, obscured bottom if there is a system bar there, and disappearing off the right edge if there is a system bar on the left.
Kludge keyboard view for Android 15 only.
MrFaul commentedon Dec 4, 2025
This is an issue for a lot of people right now.
An easy clutch in the meantime would be configurable offsets in the settings.
sk-Prime commentedon Dec 5, 2025
I am facing this issue too.
proidit commentedon Dec 9, 2025
same problem. i see this is old issue. no solution... no possible to use it...
arjunahmads20 commentedon Jan 5, 2026
The bug only appears in my phone when it is in landscape mode. So I fixed this by adding this if statement inside the KeyboardLayoutView.java -> onMeasure().
if (availableHeight < avaliableWidth) { availableWidth = (int) (availableWidth * 0.92f); }Screenshot:

Link of the resulting apk:
https://drive.google.com/file/d/1ctoGLuK3c0pMLn0iuTZtHwPsc8vO3R6J/view?usp=drivesdk
sk-Prime commentedon Jan 6, 2026
the problem is still there. I installed the attached apk from gdrive.
The problem was not in android 14, i am facing this issue after updating to android 15.
arjunahmads20 commentedon Jan 7, 2026
@sk-Prime Have you tried it in landscape mode?
larrychips commentedon Jan 7, 2026
The horrible kludge I committed a while ago is now available as a release with a built and signed APK here. I don't know if this works for everyone: it is, as I said, a horrible kludge.
iwansal64 commentedon Sep 19, 2026
It seems this problem has been solved!
I'm using the latest version from github and it worked perfectly fine. The bug still exists if you install it from playstore though.